Design More Physics

Anthodeus

Member
Contributor
@Skaldarnar you make a good point. The only entity updated should be the current one since we don't want setting the speed twice. The snippet technically would do nothing different (since there are no additions, just setting of speeds), but there would be redundancy. Synchronizing the two is an option that could do a check to see if their velocities have already been set to opposite directions.

Besides this, there could be some minor improvements in performance by not getting Rigidbody and Rail components until after we do the character check and nullcheck. We might also be able do disable the players's rigidbody while he's inside the cart so there isn't an event of that sort sent every frame?
 
Last edited:

Michael

Moderator
Contributor
Architecture
I was thinking about using the the collision hull. It returns points and impulses to separate two object. Maybe I could add that to the event if that could be of any use. I guess I could treat this as a linear system and not bother with this.
 
Last edited:

Anthodeus

Member
Contributor
@Michael If you're thinking about a "3D" collisions (to have movement not parallel to the rails), then the normals and such might be important. For the case in question though, where you wanted a minimal system where only carts interacted with each other, setting their speed in the moment of collision is pretty much giving them an impulse. You can calculate these yourself by taking into account some of the factors that I mentioned earlier or create your own.

If you want carts to decelerate to a maximum speed they had set (in case going over the max speed is allowed and the collision forced such great speed) you can change the behaviour of the cart on update. I'm curious as to what you have envisioned for the way they act following a collision.
 
Last edited:
Top