View Full Version : Avoid Gimbal lock on collision of instanced particles.
03-21-2010, 01:55 AM
The particles are:
- set to a randomized rotation between -360 and 360 degrees in all 3 axis of x, y, z.
- set to taper and land flat depending on the angle of rotation closest too.
The landing collision works perfectly except for a case in which a Gimbal lock occurs...which there are always a couple particles that do a weird flip because it simply can't rotate correctly on the specified axis.
Any way possible to avoid Gimbal lock in a case like this?
Only way I would think is to restrain one of the axis to 0 at all times so that it only rotates on 2 axis..but then the particles wouldn't have a true random rotation and would look unrealistic at times.
I was also thinking if there was a way to detect Gimbal lock when it happens on collision and alter the rotation a little bit so that it can land correctly...but that would also force it to look unrealistic at times as well...
Any help would be greatly appreciated. :thumbsup:
03-22-2010, 06:55 AM
What I tend to do to avoid situations like that is the following:
rotPP = rand(360)
assign a rand rotAxis to each particle either <<1,0,0>>, <<0,1,0>> or <<0,0,1>>
assign rand speedPP
rotPP += rotAxis * speedPP
something along those guidelines.
The initial rand(360) will orient them all differently. Then each one would rotate on a single axis, but each would be oriented differently and rotating on a different axis.
Hope that helps,
03-22-2010, 05:03 PM
Hello there and I appreciate the response.
There may be some misunderstanding.
Is that what you do to avoid gimbal lock? or is that how you rotate an instanced particle?
That's what I already have set up...the rotations work great. That is not the issue..the issue is I am getting a Gimbal lock on collision of the piece landing and it then creates a weird flip on any random pieces.
The only difference i see with your set up to mine is that my range is rand(360) and also rand(-360).
03-22-2010, 05:08 PM
Can you post a playblast?
03-22-2010, 05:28 PM
A playblast of my current scene? no. I couldn't..but..
What I can do is set up an example scene of blocks with the same setup for rotations and playblast it. I won't be able too till later tonight though.
if you can picture this...
Basically it rotates like a charm and lands flat on the ground..but there are a couple that are gimbal locked on collision for the landing and flip around within the 360 degrees instead of the 180 degree they are supposed too. I've checked the numeric rotational value of the specific particles doing the weird flipping and then input those rotational values into an object in the scene..The axis I have set to taper the rotation to land is gimbal locked. Which means it won't allow the current axis of rotation to rotate in the correct way. So it does a weird flip instead.
03-22-2010, 10:16 PM
I can think of two things that might aid in avoiding gimble lock when using Particle Instancing: 1. assign a aim axis for the instancer. 2. Bake out the instancer using nimble tools to convert the instances into animated instances and tweak the rotation curves
1. You might have to assign an aim axis for each particle so that they orientate a correct way. Which direction kind of depends on the scene, because by default it is set to +Y which might not be the best solution for you scene. An example scene to check out would help.
2. This limits flexibility of modifying the particle behavior but if your shot is pretty much locked down with the exception of these few weird rotations, nimble tools would be the way to go. Just bake the instancer out to animated instances and adjust the rotation curves for the problematic particles.
03-22-2010, 10:16 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.