- Home /
How to climb trees like a squirrel.
Hello, I need some help with a project I'm working on for my VR class. I've decided to make a "Squirrel Simulator", by I have no idea how to do the climbing on trees part. I was thinking of switching the gravity so the squirrel is attracted to the tree or the branch it's currently on, but I'm having trouble on how to make a fake gravity work on a cylindrical body.
Any advice?
can you please send me source code in which you make squirrel able to climb on tree i will be very thankfull to you.
I'm so sorry, I abandoned that project a long time ago and I don't think I have the source code anymore. Didn't really solve anything, anyway.
In hindsight, you should probably find how similar climbing methods were implemented. Something like Raz's climb from Physchonauts would do it.
Answer by xxmariofer · Jan 13, 2019 at 11:47 AM
i would disable gravity or set it to 0 when you start climbing and create a vector in the fixed update from the center of the squirrel to the center of the tree (not taking into account the Y) for creating your custom gravity. You can then give the rigidbody a force or a velocity using that vector. @nirast
That did it, thanks
Edit: I was kinda rushing ahead. How would I do it for the branches? (I assume there's something to do with their x and z positions).
Edit 2: NV$$anonymous$$, I've actually managed to make it work.
Answer by sh_code · Jan 13, 2019 at 08:52 PM
This is a non-trivial issue. (Why do you think the ability to climb trees was such a revolutionary feature in Assassin's Creed 3, even though it's still much more limited than what you're trying to do?)
The simplest thing I can think about is: when you touch the tree, disable gravity for the squirrel, and start adding a force to the squirrel which is precisely opposite to the normal of the surface of the tree that it's touching/trying to climb.
Also, next time, choose a homework you have at least SOME idea about how you're going to implement it.
I've actually managed to get something working, if you want, I'll update you on my progress or send you the source code once I'm done.
thanks, but to be honest, I'm not that interested. I'm happy you figured it out, though ;)
Your answer
Follow this Question
Related Questions
wall climbing 0 Answers
Wall Walking / Vertical Climbing (+ Gravity!) 1 Answer
Can the Locomotion System be adapted to climb vertical surfaces? 2 Answers
Wall Climbing and Default Gravity 1 Answer
Grappling Hook 0 Answers