Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

How to change bullet on impact?

$
0
0
Hi everyone, I'm making a 3rd person shooter that involves shooting with paint bullet. Currently my bullets are rigid but I want them to behave like a liquid on impact with other players. Can you please tell me in a specific manner (don't hesitate to change my code) how I can do this? This is my shooting script: var projectile : Rigidbody; var speed = 10; var fireRate = 0.11; private var lastShot = -10.0; function Update () { if(Input.GetButtonDown("Fire1")){ if(Time.time > fireRate+lastShot){ clone = Instantiate(projectile, transform.position + new Vector3(0.0f, 1.7f, 0.0f), transform.rotation); projectile.tag = "BulletTwo"; clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed)); lastShot = Time.time; } Destroy(clone.gameObject, 3); } } Thanks!

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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