- Home /
Translate Jump Trigger Collision Issue
Hi,
I have a 3d based game and i have my player jump forward (like a parabola curve) using Translate. My player jumps perfectly.
I have a Trigger setup on a collectible item (coin), the problem is when i land ontop of the Trigger whilst the player is falling it crashes into it (hits the trigger) causing it to stop before they finish jumping.
Whats strange is that my player can also pick this item up by walking (using translate again) on one axis and it doesnt behave the same, it walks a straight into the trigger and collects the item.
Is there an issue with a jump which uses Translate when colliding with Triggers with a collider as a trigger.
Thanks
Nick
Edited: added my code (c#) for jumping forward
using UnityEngine;
using System.Collections;
public class jump : MonoBehaviour {
public float forward, up;
public float maxForward = 10, maxUp = 10, speedForward = .01f, speedUp = .01f;
public bool jumpBool;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyUp(KeyCode.Space))
{
jumpBool = true;
}
if (jumpBool)
{
if (forward <= maxForward)
forward+=speedForward;
if (up <= maxUp)
up +=speedUp;
transform.position = new Vector3 (transform.position.x + forward, transform.position.y + up, 0);
}
}
}
It's probably something inside your script so you may want to show it here.
Answer by coxy17 · Nov 18, 2014 at 07:34 PM
solved it by not just Translate to jump, instead used AddForce.