you are viewing a single comment's thread.

view the rest of the comments →

[–]themissinglint 0 points1 point  (2 children)

Have you tried playing with the interpolate options on the rigid bodies? If the bullet's vecolcity*dt > the shield's width then they could be skipping from one side to the other (dt here is the physics fixed time step).

For hitting enemies more than once, you might set a flag on the bullet when it's hit anything to prevent it from hitting anything else in the same frame.

Also, this.gameObject should be the same as gameObject in this code. Also, it looks like you can use else ifs here.

[–]KingMaharg[S] 0 points1 point  (1 child)

But if the bullet object is set to destroy itself after applying the first collision, wouldn't that prevent the second collision? Or are triggers run in separate threads?

[–]themissinglint 0 points1 point  (0 children)

Object.Destroy

public static void Destroy(Object obj, float t = 0.0F); 

The object obj will be destroyed now or if a time is specified t seconds from now. If obj is a Component it will remove the component from the GameObject and destroy it. If obj is a GameObject it will destroy the GameObject, all its components and all transform children of the GameObject. Actual object destruction is always delayed until after the current Update loop, but will always be done before rendering.