Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnCollisionStay(Collision col) {
- usedforce = Mathf.Clamp(force - force * rangechange * damping, 100, force * 2);
- direction = tform.position - targetPos.position;
- player.AddForceAtPosition(direction * usedforce, targetPos.position);
- }
- void FixedUpdate () {
- range = (tform.position - targetPos.position).magnitude;
- rangechange = oldrange - range;
- oldrange = range;
- body.AddForce((targetPos.position - tform.position) * speed, ForceMode.Acceleration);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement