Skip to main content
Commonmark migration
Source Link

##You can check the speed of both cars##

You can check the speed of both cars

During collision, there will be two cases:

  1. One car is moving, one car is stationary.
  2. Both cars are moving.

You need to decide which car intentionally hit the other, and obviously, OnTriggerEnter() will not help. To check for speed, use GetComponent<Rigidbody2D>().velocity or GetComponent<Rigidbody>().velocity.

case one - one car is stationary###stationary

In the first case, it's pretty simple. The car that has speed is the car that is hitting the other car.

case two - both cars are moving###moving

It's tricky for the second case. You can say the car with more speed intentionally hit other car; though it's not always true, it will work most of the time.

##You can check the speed of both cars##

During collision, there will be two cases:

  1. One car is moving, one car is stationary.
  2. Both cars are moving.

You need to decide which car intentionally hit the other, and obviously, OnTriggerEnter() will not help. To check for speed, use GetComponent<Rigidbody2D>().velocity or GetComponent<Rigidbody>().velocity.

case one - one car is stationary###

In the first case, it's pretty simple. The car that has speed is the car that is hitting the other car.

case two - both cars are moving###

It's tricky for the second case. You can say the car with more speed intentionally hit other car; though it's not always true, it will work most of the time.

You can check the speed of both cars

During collision, there will be two cases:

  1. One car is moving, one car is stationary.
  2. Both cars are moving.

You need to decide which car intentionally hit the other, and obviously, OnTriggerEnter() will not help. To check for speed, use GetComponent<Rigidbody2D>().velocity or GetComponent<Rigidbody>().velocity.

case one - one car is stationary

In the first case, it's pretty simple. The car that has speed is the car that is hitting the other car.

case two - both cars are moving

It's tricky for the second case. You can say the car with more speed intentionally hit other car; though it's not always true, it will work most of the time.

Improved formatting, spelling, punctuation and grammar; removed ending comment
Source Link

There##You can check the speed of both cars##

During collision, there will be two cases:-

1.One is moving one is stationary.

2.Both moving.

  1. One car is moving, one car is stationary.
  2. Both cars are moving.

So how will youYou need to decide which car intentionally hit anotherthe other, well OnTriggerEnterand obviously, OnTriggerEnter() will not help obviously.

You can To check the speeds of both cars in two casesfor speed, use GetComponent<Rigidbody2D>().velocity or GetComponent<Rigidbody>().velocity.

case one - one car is stationary###

In 1stthe first case its, it's pretty simple the one having. The car that has speed hitsis the car that is hitting the other car.

case two - both cars are moving###

but itsIt's tricky for 2ndthe second case , you. You can say the car with more speed intentionally hit other car; though itsit's not always true but, it will work most of the time.

use,

GetComponent<Rigidbody2D>().velocity GetComponent<Rigidbody>().velocity 

I hope this is what you want :)

There will be two cases:-

1.One is moving one is stationary.

2.Both moving.

So how will you decide which car intentionally hit another, well OnTriggerEnter will not help obviously.

You can check the speeds of both cars in two cases

In 1st case its pretty simple the one having speed hits the other.

but its tricky for 2nd case , you can say car with more speed intentionally hit other though its not always true but it will work most of the time.

use,

GetComponent<Rigidbody2D>().velocity GetComponent<Rigidbody>().velocity 

I hope this is what you want :)

##You can check the speed of both cars##

During collision, there will be two cases:

  1. One car is moving, one car is stationary.
  2. Both cars are moving.

You need to decide which car intentionally hit the other, and obviously, OnTriggerEnter() will not help. To check for speed, use GetComponent<Rigidbody2D>().velocity or GetComponent<Rigidbody>().velocity.

case one - one car is stationary###

In the first case, it's pretty simple. The car that has speed is the car that is hitting the other car.

case two - both cars are moving###

It's tricky for the second case. You can say the car with more speed intentionally hit other car; though it's not always true, it will work most of the time.

Source Link

There will be two cases:-

1.One is moving one is stationary.

2.Both moving.

So how will you decide which car intentionally hit another, well OnTriggerEnter will not help obviously.

You can check the speeds of both cars in two cases

In 1st case its pretty simple the one having speed hits the other.

but its tricky for 2nd case , you can say car with more speed intentionally hit other though its not always true but it will work most of the time.

use,

GetComponent<Rigidbody2D>().velocity GetComponent<Rigidbody>().velocity 

I hope this is what you want :)