FragMate CommunityLog in

FragMate - Software and Game Developer Community, including Resources, Forums, Marketplace & More.

Share

descriptionNeed some help on Rocket League-esk game (Cannot figure out aerodynamics/boosts/keeping momentum while jumping)

more_horiz

So as you can see this is my mini game project so far. Whenever the car jumps it just goes straight up and doesn't keep the same speed/momentum.

(Just another picture)
Here is my source.

Code:

using UnityEngine;
using System.Collections;


public class Jump : MonoBehaviour
{
    public Rigidbody truck;

    void Start()
    {
        truck = GetComponent<Rigidbody>();
    }
    void FixedUpdate()
    {
        if (Input.GetKeyDown(KeyCode.B))
        {
            truck = GetComponent<Rigidbody>();
            truck.velocity = new Vector3(0, 7, 0);
        }
        else if (Input.GetKeyDown(KeyCode.LeftControl)) {
            truck.velocity = new Vector3(0, 3, 4);
             }
    }

        }


Let me know if there is something I am missing. I am on 5.3.5f1,
Edit: I was able to fix the inertia/momentum flaw using this to set only the y axis to a different value.

Code:

rigidbody.velocity = new Vector3 (rigidbody.velocity.x, 10f, rigidbody.velocity.z);


Last edited by SantaClause on Tue Jun 07, 2016 10:02 am; edited 1 time in total (Reason for editing : Found fix.)

descriptionRe: Need some help on Rocket League-esk game (Cannot figure out aerodynamics/boosts/keeping momentum while jumping)

more_horiz
Hello

We see that you have some issues with your project/script, however we can help you for a price. If you would like us to work for you then please feel free to contact us at http://RenntekStudios.co.uk or on Skype at RenntekStudios thanks

Our prices are very cheap. Little errors we can fix for free, otherwise projects we can discuss prices. Hope you get in touch shortly thank you...
Permissions in this forum:
You cannot reply to topics in this forum