- Home /
Addforce up to kenemetic rigidbody of the triggerobject player
This is not working some one know why i dont get any errors it just does not do enything i wanted to modefy it so that its like a force jump plate witch wil trow you in to the air when you trigger it but as i sad its not working and yes its marked as is trigger
My Player is controlled by a Firstperson Controller and my rigid body on the player is set to use graphity and is kenemetic it has to be that way other wise mt fpscontroller wil freakout
but that is also the problem is tnare a way to add the force to the gameobject or the fpc controller?????
using UnityEngine;
using System.Collections;
public class ForcePlateAddForce1 : MonoBehaviour {
public float thrust = 100f;
void Start()
{
GameObject.FindGameObjectsWithTag("Player");
GetComponent<Rigidbody>();
}
void OnTriggerEnter(Collider col)
{
var rb = col.gameObject.GetComponent<Rigidbody>();
if (col.gameObject.tag == "Player")
rb.AddForce(transform.up`enter code here`* thrust);
}
}
Answer by hexagonius · Jan 17, 2016 at 08:42 PM
Using a controller script that relies on kinematic Rigidbodies is a bad idea. have you tried your code without running the controller script? Anyway, you should rework the controller so it doesn't freak out on non kinematic Rigidbodies
Answer by Wesley21spelde · Jan 17, 2016 at 09:06 PM
@hexagonius this is i standard script fron the unity charatcers folder the controller is turned butwhen i spawn my networn character script wil activate it
but is thare not an other way to get do this maybe by the transform??