Jump to content

Bounce a player/player + car when hit colshape


ds1-e

Recommended Posts

  • Moderators

The easiest way would be invert it's velocity. But in some cases it might not be very accurate. (In case of a player you have to lift him up a little bit)

getElementVelocity
setElementVelocity

-----

 

Another way would be resetting the player back to it's previous position. (This might require some more performance impact as you will have to record it's previous position at all times.)

-----

 

Another way would be: calculate from the position of the vehicle/player and the position colshape the difference.

- Based on each separated axis: x1 - x2, y1 - y2, z1 - z2 (vector)

- Based on all axis. (Distance) [might not be required]

 

In case of a sphere colshape the distance from the center is always the same. So you do know how much distance is required to move somebody out of the sphere.

If you normalize the vector and multiply it by the required distance, what kind of result do you think that will have? (Just becareful not place the player in the ground....)

 

---

 

The last way.

Just teleport him to a known location out of the area.

 

 

 

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...