Sprite - No Rotation. Am I missing something?

New releases and general discussions.

Post » Tue Aug 10, 2010 12:10 am

Hi guys.

I've got these round sprites that use the Physics plugin, all set up correctly to bounce as they should of various objects, and the result is exactly as I want it.

The only problem is that I have the shading on the sprite so that the light-source appears to be coming from top-left, and if I tick the No Rotation box of the sprite, the sprites movement is completely different to how it is when No Rotation isn't ticked.

I assumed that ticking the No Rotation box would not affect the Physics behaviour of the sprite, just the display of the sprite.

I'm going to have a go right now at trying find a solution, but am I missing something?
Is there a way to have the sprite act like it was rotating, but the image isn't rotating?

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Tue Aug 10, 2010 12:14 am

Ok, just had a go at enabling the rotation so that I get the movement I require, and updating all the instances of the sprite with angle=0 every tick, and it seems to work fine.

Maybe reading this will help people who have a similar problem.

Maybe the Physics behaviour should have a tick-box for physics rotation and another one for sprite rotation.

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Tue Aug 10, 2010 4:00 pm

You have to remember that the physics behavior keeps an internal map of all objects that use the behavior, including the angles.
You might try setting "animation angle", but that only works in 45 degree increments.
Or you can always use a dummy.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Tue Aug 10, 2010 11:32 pm

My current method seems to be ok.

If you have a ball shape that bounces with gravity off various objects, you get a nice, realistic look to the movement of the ball, but the sprite itself rotates, which looks odd.

Imagine a nice 3D Max rendered, shiny metal ball.
The last thing you want is the ball rotating visually, because you lose the effect of the reflections.
Ticking the No Rotation box keeps the ball looking like a ball bearing, but the movement of the ball is affected by a considerable amount.

With shapes other than round balls, I can understand why it doesn't matter, but to keep round objects looking 3d, it would have been useful to keep the graphics separate from the physics rotation.

No matter though.
As I say, setting the angle to zero every tick seems to work without a performance hit.

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Wed Aug 11, 2010 5:05 pm

You could also make a dummy sprite for the ball "graphic" and have it constantly follow the x,y coordinates of the physics object.

Whatever works though. If it doesn't affect the performance using an angle reset then that's cool too.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Wed Aug 11, 2010 11:58 pm

Yeah, my current method seems to be fine with several instances on screen at once, so no problem.

This morning I did something similar to what you mention with a horizontal moving platform.
For some reason, adding both a Physics behaviour and a sine behaviour to the same object causes the sine behaviour to misbehave.

With just the sine behaviour controlling the horizontal movement of the platform on it's own, it moves correctly.
But with the physics behaviour added too, the sine behaviour causes the platform to not reach it's offset each turn, which means that it eventually edges it's way off screen and doesn't come back. :shock: ??

I solved it by using the dummy with the sine behaviour for position, and the platform for the physics behaviour.

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Thu Aug 12, 2010 2:50 pm

Awesome... best of both worlds then eh?

:D

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests