Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Error problem with addforce

$
0
0
Hello i have a problem with my script. Trying to add force to this gameobject when i shoot it with my raycast. And it will move AWAY from the player (where the raycast it casted from). But i get a nasty error: "Operator '-' cannot be used with a left hand side of type 'UnityEngine.Transform' and a right hand side of type 'UnityEngine.Transform'." Script: #pragma strict var rb : Rigidbody; var force : float; var PlayerPosition : Transform; var HittedObjectPosition : Transform; function AddForceFunction () { rb.AddForce(PlayerPosition - HittedObjectPosition).Normalized * force; }."

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>