



Reply From: 
Gokudomatic2 
I think you can’t really find it out. You can only trying to figure which cell was at the collision point.
But if you only want to know if your body is colliding with a ramp, you can check the normal of the collision. If it’s not straight horizontal (a wall) or vertical (the floor), then it’s a ramp.
Thank you for your help, but I don’t understand how to do this. How do I find the angle from the Vector3?
Eyeball Monkey Media  20160702 16:44
Since you’re using a KinematicBody, it has the method get_collision_normal()
, which looks like this:
normal collision – GeoGebra
After that, a dot product of the normal on the velocity will tell you if it’s perpendicular (vertical wall, dot product being zero) or something else.
To know where to orient your body to climb up the ramp, doing the dot product of the up vector (Vector3(0,1,0)
) on the normal, then multiply the result to a normalized vector of the normal, then substract it from the up vector to get the final vector that slides along the ramp towards the top:
vector to climb – GeoGebra
Gokudomatic2  20160702 17:27
Thank you! How do I figure out how to rotate my body with this?
Eyeball Monkey Media  20160805 23:59
There are many different ways to do it. But the simplest is to create a transform, for instance with the method looking_at
, and apply it to the node.
And if you still didn’t do it, you should definitely read the official documentation about vectors and transforms. It explains the fundamentals about all this and it contains lot of examples in gdscript.
http://docs.godotengine.org/en/latest/tutorials/_misc_tutorials.html
Gokudomatic2  20160806 06:52