Getting touch offset to play nicely with thrown object.
So basically, I have created a scene with touch offset and a larger hitbox, COMBINED with throwing an object. Once touch offset is added to the equation, throwing won't work anymore. As you can see in the included scene file, the farther you touch from the object, the farther the object flies.
Weird behavior, I've been going at this all morning and getting nowhere. Any ideas would be very welcomed.
http://www.mediafire.com/?85gnnfe85ls4bg1
Weird behavior, I've been going at this all morning and getting nowhere. Any ideas would be very welcomed.
http://www.mediafire.com/?85gnnfe85ls4bg1
Comments
First make two new 'real' attributes: oldMouseX and oldMouseY
Next, modify the last two constrain behaviors like this:
Constrain Attribute: self.Motion.LinearVelocity.X To: 10*( game.Mouse.Position.X - self.oldMouseX )
Constrain Attribute: self.Motion.LinearVelocity.Y To: 10*( game.Mouse.Position.Y - self.oldMouseY )
Then add two more constrains:
Constrain Attribute: self.oldMouseX To: game.Mouse.Position.X
Constrain Attribute: self.oldMouseY To: game.Mouse.Position.Y
Make sure that the oldMouse constrain behaviors come after the linear velocity constrain behaviors (as above), order is important.
Lastly, you probably need to use a larger multiplier than 10. (But that is a personal preference.)
Hope this helps!
RThurman
http://www.mediafire.com/?92nwwpnavzg6eg5
Thanks again!
Hope this helps!
RThurman
RThurman