- Home /
How do I make my knife stab in a tree?
I have my knife throwing script here, but how do I make my knife stab? I tryed MyRigidbody.velocity = Vector3.zero; Destroy (MyGameObject.GetCompponent()); MyRigidBody.isKinematic = true; etc. Here is my throw script:
using UnityEngine;
using System.Collections;
public class Throwinit : MonoBehaviour {
public Rigidbody knifePrefab;
public Transform knifeSpawn;
public float Speed = 750f;
public float rotateSpeed = 750f;
public int maxKnifes = 4;
public int currentKnifes = 4;
void Update ()
{
if(Input.GetButtonDown("Fire1"))
{
if (maxKnifes <= 0)
{
return;
}
Rigidbody knifeInstance;
knifeInstance = Instantiate(knifePrefab, knifeSpawn.position, knifeSpawn.rotation) as Rigidbody;
knifeInstance.AddForce(barrelEnd.forward * Speed);
knifesInstance.AddTorque(barrelEnd.right * rotateSpeed);
maxKnifes = currentKnifes -1;
currentKnifes = maxKnifes;
}
}
}
Can someone help me? Thanks
Yeah, but it's not going to help asking multiple times the same question.
Please don't ask multiple times: http://answers.unity3d.com/questions/1403584/how-do-i-make-my-knife-stab-in-a-tree.html
Answer by jmgek · Sep 07, 2017 at 11:44 PM
I've already sent this to moderation because it's a duplicate. @mods Are you guys reading the comments before you accept them?
http://answers.unity3d.com/questions/1403584/how-do-i-make-my-knife-stab-in-a-tree.html
Your answer
Follow this Question
Related Questions
How do you cause damage based on object Velocity? 0 Answers
How do I make my knife stab in a tree? 2 Answers
When I throw the projectile, it triggers the land collision before landing on it 0 Answers
In Unity how to “throw” a sprite with a player if both has rigidbody2d and colliders? 0 Answers
How to speed up? 3 Answers