Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Need some help on Rocket League-esk game (Cannot figure out aerodynamics/boosts/keeping momentum while jumping)

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

View previous topic View next topic Go down  Message [Page 1 of 1]

SantaClause


Member [Lv. 1]
Member [Lv. 1]

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.)

View user profile

jakeyiii


Member [Lv. 3]
Member [Lv. 3]
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...

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum