Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Unity make a homing object

// This code was originally written by Brackeys

Vector2 direction = (Vector2)Target.position - rb.position;
direction.Normalize();
float RotateAmount = Vector3.Cross(direction, transform.up).z;
rb.angularVelocity = -RotateSpeed * RotateAmount;
rb.velocity = transform.up * Speed;
Comment

PREVIOUS NEXT
Code Example
Csharp :: visual studio auto generate and setters 
Csharp :: c# fastest way to find item in list 
Csharp :: if equal statement c# 
Csharp :: serenity.is required field 
Csharp :: windows forms webbrowser goback 
Csharp :: split string by 5 characters c# 
Csharp :: and in c# 
Csharp :: nullable IList 
Csharp :: viewresolver cyrillic 
Csharp :: enum extends dictionary c# 
Csharp :: Delegates in UntiyC# 
Csharp :: how to select class object from query c# 
Csharp :: how to add multiple values in session in asp.net visual studio 
Csharp :: AutoFixture ignore property 
Csharp :: dynamic c# .add 
Csharp :: c# file watcher specific file 
Csharp :: constructor in protobuf-net 
Csharp :: one to many relationship in asp net entity framework with role 
Csharp :: Nested objects with linq expression 
Csharp :: c# operators 
Csharp :: unity inspector sliders 
Csharp :: unity reload script assemblies 
Csharp :: c# web scraping get images from specific url 
Csharp :: c# second last index 
Csharp :: how to make a enemy in unity 
Csharp :: how to move balance from one card to another target 
Csharp :: export2excel with logo and header and many table on one click stackoverflow 
Html :: html tab icon 
Html :: bootstrap cdn link 
Html :: open vsc with admin rights linux 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =