Original Post
So, more physics stuff for FPS games!
If i want to intersect the walls and floor with the player how do i do it? Most of this i believe i have worked out. I don't use a physics volume at the moment, i cast 5 rays, forward, backward, left, right and down. When i walk and jump around in open space, on a piece of floor terrain it all works fine. I cast the rays and the downard ray is the only one that intersects and has an intersection point within range. The normal comes back as (0,1,0), i dot this with the velocity for the frame which is straight down for gravity and the normal cancels out the downward movement.
But how do we combine intersections with walls? If i walk forward and hit a wall that has a surface normal of (0,0,-1), and i also have the intersect with the floor, should i combine these normals to give me (0, 0.707, 0.707) and then resolve the velocity using the dot product? I have tried this and it causes the player to drop through the floor slowly (because the gravity direction dotted with the accumulated normal gives a slight downards motion.
Do we run the floor intersection and surroundings intersection in two distinct passes, or can we combine them as described above?
Thanks,
If i want to intersect the walls and floor with the player how do i do it? Most of this i believe i have worked out. I don't use a physics volume at the moment, i cast 5 rays, forward, backward, left, right and down. When i walk and jump around in open space, on a piece of floor terrain it all works fine. I cast the rays and the downard ray is the only one that intersects and has an intersection point within range. The normal comes back as (0,1,0), i dot this with the velocity for the frame which is straight down for gravity and the normal cancels out the downward movement.
But how do we combine intersections with walls? If i walk forward and hit a wall that has a surface normal of (0,0,-1), and i also have the intersect with the floor, should i combine these normals to give me (0, 0.707, 0.707) and then resolve the velocity using the dot product? I have tried this and it causes the player to drop through the floor slowly (because the gravity direction dotted with the accumulated normal gives a slight downards motion.
Do we run the floor intersection and surroundings intersection in two distinct passes, or can we combine them as described above?
Thanks,