Playmaker Forum

PlayMaker Updates & Downloads => Official Action Updates => Topic started by: mrmagoo on January 14, 2014, 09:48:21 PM

Title: Mouse look fix
Post by: mrmagoo on January 14, 2014, 09:48:21 PM
This started as a bug but then I found the source of it so I ended up fixing it myself. There is a related bug report but I figured posting it here also would be the right thing to do.

This is my first look into any playmaker code at all (I now have all of 10 mins experience with it!) so go easy on me.  ;D

The problem is that once you have used mouselook to rotate an object it will have its constraints frozen permanently.

It appears it was a piece of code that was only added because it was part of the unity code it was borrowed from. I think the code is necessary because there could be problems with other rotational effects causing the mouse control to appear buggy to the user. Exposing it as an option to the user to turn on and off is a good idea but only half the solution.

Code: [Select]
// Make the rigid body not change rotation
// TODO: Original Unity script had this. Expose as option?
if (go.rigidbody)
{
go.rigidbody.freezeRotation = true;
}

Two problems:


I would suggest that what should happen is:


Rather than just hand this over and expect someone else to do all the work I decided to have a crack at doing this myself. :)

Because the playmaker framework is so elegant it was trivial. (assuming I got it right)

I have attached my attempt at this code. :) I hope this is correct.
Title: Re: Mouse look fix
Post by: Lane on January 14, 2014, 10:56:42 PM
 Haven't looked at the patched action yet, but I'm assuming that they freeze the rotation of the rigidbody to prevent physics input from causing jitter or entering odd rotations that the player did not expect.

Probably best to expose it an optional check box with true default if the patch goes to build.
Title: Re: Mouse look fix
Post by: mrmagoo on January 15, 2014, 04:44:03 PM
I understand and agree with why it is there, just not with the particular implementation. (unity's fault in this case it appears)

Which is why I did exactly that in my code. :) The numbered list describing my ideal implementation is exactly what my code does. (well...I hope! ;) )
Title: Re: Mouse look fix
Post by: artician on February 26, 2014, 10:11:57 AM
I have a project that is suffering from this exact issue.  Do you know if your fix worked?  I'll try to check it out later today.