How to flip an AI car right side up? Unity Hybrid-ECS/DOTS
In this short video, we will implement a very basic vehicle reset/flipping system which can flip our car back upright after it topples.
We are going to deduce the orientation of our vehicle using the dot product. We are already passing the local to world Matrix from which we could have figured the necessary local transform direction - upward pointing direction.
Fortunately, this time Unity has a struct that can do this job for us.
Now that we have a hook to figure if our vehicle has toppled, we will simply reset the rotation to that of initial rotation. we can make it aesthetically more pleasing and accurate if necessary, by lerping the rotation values & orienting vehicle to current forward direction etc., but we won't make this too complicated here
Please watch my previous videos to get a better understanding of the system we have implemented so far.
This is an excellent use case demonstrating how classic Game Objects can be mixed with Unity ECS/DOTS in a hybrid fashion to achieve desired behaviour.
Unity Hybrid-ECS/DOTS Car Controller - https://youtu.be/f0viJi8vi5I
AI Car - Unity Hybrid ECS/DOTS - https://youtu.be/qjfjdYVKQu0
AI Car Testing on a Massive terrain - https://youtu.be/L7Uhk9zhEjo
*************************************************
Terrain textures - https://www.textures.com/
Procedural Terrain - Map Magic 2- https://assetstore.unity.com/packages/tools/terrain/mapmagic-2-165180
Wheels - https://assetstore.unity.com/packages/3d/vehicles/land/tire-pack-147202
*************************************************
Science & Technology
#How to flip a car right side up? Unity Hybrid-ECS/DOTS
#Unity DOTS
#Unity ECS
#Unity AI Car Flip
#ecs Unity
#Unity Dots Ecs
#Basic
#Implement basic flipping
#AI car controller
#How to rotate a car back upright
#How to reset car position
#How to reset car after it falls
#How to rest a car after it topples
#Unity Hybrid-ECS
#Matrix
#Dot Product
#Unity Mathematics
#ECS Local to world
#Vectors
#Local Transform direction in Unity ECS
#GameObjects