unity instantiate vector3
using UnityEngine;// Instantiate a rigidbody then set the velocitypublic class Example : MonoBehaviour
{
// Assign a Rigidbody component in the inspector to instantiate public Rigidbody projectile; void Update()
{
// Ctrl was pressed, launch a projectile
if (Input.GetButtonDown("Fire1"))
{
// Instantiate the projectile at the position and rotation of this transform
Rigidbody clone;
clone = Instantiate(projectile, transform.position, transform.rotation); // Give the cloned object an initial velocity along the current
// object's Z axis
clone.velocity = transform.TransformDirection(Vector3.forward * 10);
}
}
}
Also in C#:
- The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could not be located.
- c# substring reverse
- play animation through script unity
- make a list c#
- how to turn a string in a char list c#
- c# stop loop in method
- Could not load file or assembly 'Ubiety.Dns.Core, Version=2.2.1.0
- change text color wpf
- unity 2d top down movement
- unity instantiate vector3
- reload scene unity
- unity detect any key
- c# inotifypropertychanged best practices
- sort datatable c#
- decimal to string whole number c#
- c# change variable types
- how to convert a number to 2 decimal places in c#
- singleton design pattern c# volatile
- how to see a tag of what you hit with raycast
- insert new item listview c#
- singleton unity
- automapper c# initialize error
- c# System.Resources.MissingManifestResourceException error
- using serial port in c#