- Home /
rigidbody jumping and moving with constant speed without acceleration (with video )
hi , im new to unity (3 months)
and i m making a remake of a level of an old game namaed"pepsi-man"
so i have done all stuf animations of the player , the obstacles but the movement of the can , i tryed a lot to make it throw animation and throw code but i didnt get it a good result
so now im looking for script that make the can's movement throw script .
this is the level : https://www.youtube.com/watch?v=uvygfG3VJ20
and of course the speed of the can must be constant (no acceleration)
Answer by CheetahSpeedLion · Jul 28, 2017 at 06:28 PM
Coincidentally I answered a similar question yesterday and someone else posted another good solution. The thread is here: http://answers.unity3d.com/questions/1385517/grappling-hook-3.html?childToView=1385678#answer-1385678
Hope that helps, Areleli Games
thank you but ,his probelm and $$anonymous$$e are not the same
i want a script that make the same can movement as the video shows !
Answer by TheSOULDev · Jul 29, 2017 at 11:04 PM
You could Mathf.Clamp the speed and rotation values, this would keep it inside your wanted range, but would also give your object the ability to accelerate if below that value.
Alternatively, you could code your own movement management script with more complex behaviours like deccelerating decceleration and accelerating acceleration, but the general idea is to either use Mathf.Clamp to limit a value (which is a basically a function that checks if the value is above maximum, and if it is, sets it to the maximum), or to create a mechanism or a formula that will automatically slow down the translation and rotation of an object.
My guess is that you would want to create movement that bounces when colliding with the floor, rotates at a constant speed and moves at a constant speed. This can all be done with the aforementioned solutions.
i have done the rotation and the constant speed but i have a problem with the continious jumping that if i use the simple methode of "when is grounded jump=true ....." dont works
Your answer
Follow this Question
Related Questions
How to add physics to an animation? 3 Answers
Add Relative Force 2 Answers
Need a more detailed Physics documentation 2 Answers
Why is force only being added in the same direction? 1 Answer