Copy code from here- u3ds.blogspot.com/2021/11/sim... Feel free to Like and Share to show support for this channel. Don't forget to leave a comment if anything comes to mind. Have a nice day :) #unity #csharp #tutorial
Пікірлер: 17
@hectormzt17 ай бұрын
The best example i found. i really learn to much with this. thank you!
@marcfinger45492 жыл бұрын
Straight to the point. Thanks!
@MikaelL Жыл бұрын
Thanks to you and to this tutorial I understood how to shoot bullet🙂
@BRUCESHARKYT23 күн бұрын
how to make obstacle respawn?
@leonedandrewTumbaga Жыл бұрын
anyway got mine so i declare two empty object named left and right and i base on character movement so in update i put this the one empty object i manually rotate Y into 180 "left one" //bullet public Transform bulletSpawnPointRight; public Transform bulletSpawnPointLeft; public GameObject bulletPrefab; public float bulletSpeed = 10; void Update() { if ((horizontalMove = .1f)&& (Input.GetKeyDown(KeyCode.A))) { charactermove.SetTrigger("shoot"); Invoke("shootright", 1f); } void shootleft() { var bullet = Instantiate(bulletPrefab, bulletSpawnPointRight.position, bulletSpawnPointRight.rotation); bullet.GetComponent().velocity = bulletSpawnPointRight.right * bulletSpeed; Debug.Log("throwleft"); } void shootright() { var bullet = Instantiate(bulletPrefab, bulletSpawnPointLeft.position, bulletSpawnPointLeft.rotation); bullet.GetComponent().velocity = bulletSpawnPointLeft.right * bulletSpeed; Debug.Log("throwleft"); } }
@believe1136 ай бұрын
Best video.Thanks Man helped alot.🙏
@YubisSmileStudio2 ай бұрын
thank you very much and One Big Like ;)
@Marc-eq2bi13 күн бұрын
Thank you very much
@leonedandrewTumbaga Жыл бұрын
i used this but instead of up i use right, now my problem is left
@ppproto70293 ай бұрын
Great!
@Kihaiwo Жыл бұрын
Thanks
@JJ-qo1ws7 ай бұрын
How to make it shoot 180 degrees?
@prinolangovender40944 ай бұрын
You can try something like this: var bullet = Instantiate(bulletPrefab, bulletSpawnPoint.position, bulletSpawnPoint.rotation); // Get the player's movement direction Vector2 playerDirection = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")).normalized; // Set the bullet's initial velocity based on the player's direction bullet.GetComponent().velocity = playerDirection * bulletSpeed;
@Jay-ov4qo Жыл бұрын
For some reason this didn’t work the code had no errors I did everything right, but what I have to shoot with SpaceBar? What do I have to shoot with?