Cart Movement for a hands free VR Game

Hi Everyone,

I am trying to design a game where students just use a viewer with no controls. I have managed to make the cart move by hovering over it and then stop by looking away from the Go button. When I look at the go button again, the cart starts to slow down.

I want to eventually add questions and mini games in this, but it will not work if the cart keeps slowing down to a crawl.

Can anyone tell me why this cart starts moving slower after I move off of the Go button? Also, how do I fix it so that the cart moves at one speed the whole way through even when I stop looking at the go button?

Here is the link to the game: CoSpaces Edu :: Hands Free VR Concept Test

2 Likes

Hey @Davin_Karatouliotis, you’ve run into a funny math problem;
The cart is getting the task to move along the path until the end in 50 seconds; However if you are further on the path the distance that has to be traveled in those 50 seconds is smaller, so the cart will move slower because of it. Were you to stop right before the end the cart would take 50 seconds to move for instance the last meter causing it to move painfully slow.

To remidy this we must keep track of how far along the cart is on the path. I’ve done this here by creating variable for the desired time in seconds the cart must complete the path in, then keeping track of how much time has passes while the cart is moving, calculating afterwards how much % the cart has moved along the path, adding it to its completion percent. Then to get the correct speed the desired completion time is times by 1 - the completion percent (This % is kept as a value ranging from 0 to 1), in order to get the correct time it must take for the rest of the path.

It still slows down a bit at the end, probably due to some rounding issues on CoSpaces side on handeling the time in path movements (I presume they did some rounding since moving along a path for 50.32478234823647seconds is the same as 50.32 in general cases); Unfortunatly it does seem to create a minor discrepency for this solution.

Hope this helps, and good luck with the game!

3 Likes

Thank you so much Luc!

This works perfectly for what I need. You are a life safer. I really appreciate the help.

2 Likes