Hello,
I am working on a 3D ski jump (fantasy medival) game.
Works already well but I have some problems with my rigidbody and or force…
First step driving down the ski jump slope works fine but has some brakes sometimes when the slope degree changes.
Flying works perfect (or no problems).
When hitting the landing area, sometimes it is fine (when it is nearly straight or less slope) but with higher slope degrees the player starts “flying straight forward” again…
The player has a rigidbody and a force (where I am just setting Force.force vector).
I tried increasing the RigidBody mass, seems to help a bit (not so high and far bouncing forward after landing) but not too much unless I give it absurd high values.
I tried to add a Y Force to the Z Force when after player landed, but does not seems to help much…
I set Physics.defaultContactOffset = 0.001f; but does not seem to help much.
I added some “slope” function I found I changed a bit, again it helps but not too much:
void FixedUpdate()
{
if (Force.force.magnitude > 1f)
{
Vector3 force = Force.force;
// if there's a floor beneath us
if (Physics.Raycast(transform.position, Vector3.down, out RaycastHit hit, 2f))
{
// Project our force direction to be parallel to the floor
force = Vector3.ProjectOnPlane(force, hit.normal);
// This means the force we're adding is now following the slopes angle
}
//rigidBody.AddForce(force);
Force.force = force;
}
}
I increased gravity, when not flying but that only works when I set it very high and has too much impact on driving downward .
I added a physic material to the ski jump and ground:
Now with all that changes, if player landed, it still starts flying again but not so high and far…
I know when player starts driving down, starts flying, lands (or crashes) and finishes the landing and drinving to the target area.
Can I attach the player to the ski jump and ground somehow? If not “phase is flying” keep it on the ground whatever it takes? But it still needs to move forward and maybe downwards still…
Thanks a lot