I would like to ask you a question about wall-slip implementation at Unity.

Asked 2 years ago, Updated 2 years ago, 42 views

I would like to reproduce wall slippage without using RigidBody in Unity.
There are two things I don't understand, so I'm in trouble.When I looked into the wall slippage

Using the "Direction of Progress Vector" and "Collision Point Normal" I understand that a "wall slip vector" can be produced, but
·How to draw a normal vector of collision points
·How do I use it after I actually put out the wall slippage vector?
I don't know.If possible, it would be very helpful if you could show me the formula in the code...

unity3d

2022-09-30 11:45

1 Answers

First of all, please understand that Unity and RigidBody (and Collider) components do the tedious calculations of collision determination.If you don't use it, you do the same thing yourself.

·How to get the normal vector of the collision point

Calculate the point of collision between the wall and yourself and use the normal line of the wall that collided.
If you don't use Rigidbody, you don't use Collider or Raycast, and you search for collision points from your location and movement vector while checking the shape of the wall (mesh vertices and normal data).I think collision determination can be done by collision between polygons and line segments, or collision determination between line segments in 2D.

·How can I use it after I actually put out the wall slippage vector?

How do you travel in the first place?Once the wall shift vector is calculated, all you have to do is move in that direction.If there is any other friction, we will add the calculation according to the specifications.

If possible, it would be very helpful if you could show me the formula in the code.

It is not possible to show only the formula.Access to wall data (such as vertices and normal lines) is essential for collision determination, and collision determination is not possible unless the shape of the wall is known first.


2022-09-30 11:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.