Hi everyone,
I wrote some very simple code for planetary gravity, and It works great, but now I’d like to know how I would get a character on the planet to have its feet always pointing towards the planet. I tried LookAt() the results were quite funny but not what I had in mind. so I need to use the Y vector. any suggestions?
did you try the locomotion system… ?
No I didn’t, not sure I want to either. Im sure there should be something reasonably simple that I can add to my already existing gravity code
then i suggest casting a ray downwards and let it check for ground. like you would for a jump. get the normal direction of the hit and use that to offset your characters rotation… maybe apply somekind of smoothing to avoid jitter
Hi Jister, thanks for the input ![]()
but I don’t think I want to use normals.
I just want something that works exactly the same as LookAt() but using the up vector instead of the forward vector
That shoudn`t be to hard. But where would it look at? The planet? Because then i cant walk up slopes? Anyway i think i have laying around what you want, i ll have a look when @ home.
Thanks Jister ![]()
hey sorry couldn’t find it, so i made some test real quick. but they are not 100% yet. I’ll post it here if i get something working.
also if you tell me what kind of gravity system you made maybe i can be of more help.
hey thanks. at the moment I’m using a rigidbody and physics.gravity = planet’s transform. pretty simple
hey LazyGoat i had some spare time, hope this is what you’re looking for. It’s quite robust so you’ll need to fine tune it to your liking.
1234365–52234–$planet.unitypackage (8.05 KB)
Hey Thanks Jister
I’ll have a look at it tonight