Creating a moving platform #4214
Replies: 1 comment 2 replies
-
The trickiest part here is going to be that moment in hubs is not based on the physics system but a navmesh using https://github.com/donmccurdy/three-pathfinding under the hood. You are going to need to figure out a way to either dynamically update the navmesh as the platform moves, or take into account some sort of offset of the platform when doing navmesh lookups. The other tricky part will be keeping things in sync over the network. Just syncing the start/stop like you are doing might be "good enough" but there is latency so every client is going to have a slightly different opinion about where the platform is, so you will likely get some visual artifacts. (This is quite common in many multiplayer games with moving platforms, and is the sort of default state of things unless you specifically try and account for it). One way I had considered implementing this sort of thing in the future would be to us an "occupable" waypoint that moved. Right now waypoints only update the players position when you first occupy them, but it would be fairly trivial to have them do it every frame, so that the player would essentially be "snapped into" the waypoint as it moved around. You would not be able to walk around on the "platform" which is a bit restrictive, but would avoid having to do anything fancy with the navmesh. You could imagine writing code to have you automatically enter/exit the waypoint as you reached the ends of the platforms path. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
We're using a custom hubs client to create a moving platform that users can get on and off. We've added a custom a-frame entity that is re-positioned every few frames to move at a constant speed, with a box mesh. We're creating this entity on the client and using NAF client commands to start and stop the platform. What are your opinions on this approach, is there a more ideal way to go about doing this?
On top of this, we've considered using the nav entity from Spoke to create a "moving NPC". Maybe this would be an alternate solution?
@robinkwilson If you have any suggestions or input that would be fantastic.
Beta Was this translation helpful? Give feedback.
All reactions