Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411279 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 02:57:34 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Rotation collision conflict handling
Pages: [1]
Print
Author Topic: Rotation collision conflict handling  (Read 1532 times)
zarovv
Level 0
**


View Profile
« on: November 14, 2019, 01:41:14 AM »

Hi. I was wondering about collision response for OBB, meaning for objects with rotation.

What I have is this blue rectangle between 2 red rectangles.
If I rotate it, i basically don't know how to handle the collision correctly.

I know I need to like stop the rotation or rotate it backwards but how exactly can I do that?
From what I looked online, all I  get is something called "impulse based collision response" that I understand is just applying a force to change the rotation speed AFTER you handle the collision. But how I exactly handle the collision so my shape wouldn't go crazy?

Image for reference:



Anyone has a clue? a hint?...
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #1 on: November 14, 2019, 06:24:09 AM »

I did that some time ago on a custom engine, I can't remember the details but you use the impulse theory to apply the force, and it will resolve it because you will add more than 1 point of contact, so in the drawing example it will resolve cancelling each other impulse. From the video instead it seems more like you need to increase the threshold when the impulse will act in case the object is resting on the ground.
Logged

Games:

zarovv
Level 0
**


View Profile
« Reply #2 on: November 14, 2019, 11:40:27 PM »

but how do you know how much to push? ok you know the force to push but you need to know exactly how much angle to push back or something no?
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #3 on: November 15, 2019, 03:34:38 AM »

The sum of all the point of contact should give you already the direction and angle I think.
Logged

Games:

qMopey
Level 6
*


View Profile WWW
« Reply #4 on: November 15, 2019, 10:18:42 AM »

https://www.chrishecker.com/images/e/e7/Gdmphys3.pdf
Logged
powly
Level 4
****



View Profile WWW
« Reply #5 on: November 15, 2019, 02:37:15 PM »

Simultaneous impact with multiple bodies is kind of a difficult problem tho, simple solutions won't give you satisfactory results in the general case.
Logged
zarovv
Level 0
**


View Profile
« Reply #6 on: November 18, 2019, 12:34:06 PM »

thanks you people.. i'll check it out
Logged
Frankie
TIGBaby
*


View Profile
« Reply #7 on: December 18, 2019, 02:01:52 AM »

Hi, I'm not an expert, but I'll give my 2 cents.

I see two solutions:

Step back the simulation when an overlap is detected
This is the method posted in the pdf above. When you detect two objects overlaps (for example using the SAT theorem https://en.wikipedia.org/wiki/Hyperplane_separation_theorem, step the simulation back to the previous state and step forward of Δt/2, if a collision occur step back again and forward of Δt/4, otherwise step it forward of Δt/4. Proceed in this way until you reach the precision you need.
At this point could you assume the two object are in contact and you compute the contact set between them (for example the contact set is the polygons extrema on the last separating axis).
Once you have the contact set you could compute the collision responce, and this is another algorithm.

Try to predict a collision before it occurs
You assume that the objects have a costant linear and angular velocities, and you compute the next possible position without running the ODE solver. This could be done for OOB, but the formula that take into accounts the angular velocity is quite complicated. In this way you know that the object will collide in the next time step, and could compute the contact set and collision response.


Sadly it is a really broad argument, and it is impossible deal with it here in details, but I hope that I give an idea of possible solutions.

Anyway you can find these algorithms here: https://www.amazon.it/dp/B003VIWRWW/ref=dp-kindle-redirect?_encoding=UTF8&btkr=1, in particular the second one is explained in details.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic