wallrun or object magnetized to wall
Need a help with scripting.
This concept is from a friend and the design is fairly simple for the moment. Only including jump, WASD and Shift.
What we concern at the moment is making and object "stick" to any walls or surface in front of them... And then as they move, they'll be magnetized or gravitate to the object's shape and trail along it as long as we hold shift.
Help? This is a core mechanic and we're in need to solve it.
Here's a diagram and concept to help you.
The basic variables need only be movspeed. Any thing else will be a product based on it.
What exactly are you wanting help with? Need more specifics.
Answer by iuripujol · May 02, 2017 at 08:54 AM
try using OnCollisionEnter, from there, for each collision contact, cast a ray on that direction on a certain layer (to avoid unwanted weird behaviour on unwanted surfaces) and after that use movspeed on the y axis of the tangent vector (use tangent cause it will allow you to wallrun on curved surfaces).
after that, use a timer (use as grip) which it will allow you to start and cancel the time of action (something like --> while(timer < gripTime) or you can use --> if(timer < gripTime)
and after that, in the while transition use transform.position = Vector3.MoveTowards(transform.position, yourRayCastHit.point, yourTime or movSpeed);
anyway, hope that helps, if not just send me a message:
Your answer
Follow this Question
Related Questions
I can not get my character to crouch? Character not sliding on walls? 0 Answers
Press E to Read note 1 Answer
[UNET] Rigidbody physics sync 0 Answers
i have physics problem here!! help 0 Answers