Its self explanitory, any force even “1e+21” wont move this object
Is KinimaticIs☐Off- Mass Is 950 (cant change for specifications)
- My Code Looks Ok
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Explode : MonoBehaviour
{
public float fieldOfImpact;
public float explosionForce;
public GameObject[] explosion;
public Transform[] explosionTransform;
public Transform collisionSpot;
public int life;
public float expMagnitude;
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "car"){
collisionSpot = collision.transform;
Explosion();
Destroy(gameObject);
Destroy(explosion[0]);
}
}
private void Explosion()
{
GameObject _explosion = Instantiate(explosion[0], collisionSpot.position, collisionSpot.rotation);
Collider[] colliders = Physics.OverlapSphere(transform.position, fieldOfImpact);
foreach (Collider target in colliders)
{
Rigidbody rb = target.GetComponent<Rigidbody>();
if (rb != null)
{
rb.AddForce(Vector3.up*expMagnitude,ForceMode.VelocityChange);
Debug.Log("Explosion");
}
}
Destroy(_explosion, life);
}
}
I Just Cant Figure It Out!
Also FYI I Do Get The "Explosion" Debug
– ClovirDoesUnityIs there any other script on the object that you are trying to move that might be overriding the position on every frame?
– dstearsOnly other script is a car controller script. It doesn't mess with the y axis though and its disabled
– ClovirDoesUnity