Maintain image height despite angle?

Get help using Construct 2

Post » Tue Aug 27, 2013 4:34 am

Does anyone know how to maintain an image height (of say 50%) at every possible angle? Because the way the engine works is that the height is only really "the height" when the angle is 0 degrees, as the height is spun with the angle (making it more like the "width" when rotated).

Examples:


What construct does:


What I want it to do:


I've tried several ways to do this (using sin/cos on height and width) but I don't think its possible, but just incase someone knows how that would be cool!

https://dl.dropboxusercontent.com/u/1024727/rotate%20heigh.capx
B
147
S
74
G
20
Posts: 1,786
Reputation: 22,527

Post » Tue Aug 27, 2013 11:29 am

What you're trying to do I don't believe will work. It will always pivot around your origin and that's why you get the result you do, you'd need some sort of 3D plugin to do something like this. Maybe it's worth just making a sprite with an animation of it spinning and then start the animation when you need it?
B
9
S
3
G
1
Posts: 53
Reputation: 1,296

Post » Tue Aug 27, 2013 1:02 pm

I was trying to do this for a while too for an objective indicator. What I wound up doing is I broke it into two parts, the oval and the line. Then I just set the angle of the line towards my objective and masked where it crossed out of the oval with a third sprite.
B
35
S
9
G
4
Posts: 201
Reputation: 5,170

Post » Tue Aug 27, 2013 1:42 pm

Doesnt it help if you rotate it firts, then change the height?
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

Post » Tue Aug 27, 2013 7:49 pm

I'm pretty sure there must be a mathematical way to do this with a super advanced calculation. In the meantime; just use an animation. Specially since the calculation would only work on flat images, and anything representing volume would look super weird.

here's how you'd do it EXAMPLE
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Tue Aug 27, 2013 11:29 pm

There's no way to do it by just changing the width and height of the object. I saw your other post and agree it would be useful to be able to scale layers axis separately.

Currently the only ways I can think of is using a pre-rendered animation, by a shader effect, or pasting the sprite to a canvas and resizing it:

Resize Example 01Animmaniac2013-08-27 23:30:58
Scirra Employee
B
152
S
53
G
17
Posts: 711
Reputation: 17,800

Post » Wed Aug 28, 2013 12:36 am

Thanks guys, yeah I'll just have to settle for "prerendered".
B
147
S
74
G
20
Posts: 1,786
Reputation: 22,527

Post » Wed May 25, 2016 11:57 am

Soooo, did anyone find a solution to this issue?
I almost got it working using abs(cos(object.Angle))*height however cosine only works for half of the quadrant, I guess?
Any math genius out there willing to take a stab at this?
B
41
S
22
G
18
Posts: 153
Reputation: 12,433

Post » Wed May 25, 2016 1:41 pm

@purplemonkey I'm not sure what you're trying to do, as @Animmaniac pointed out you can't actually do what I was going for without using something like the Canvas plugin.
B
147
S
74
G
20
Posts: 1,786
Reputation: 22,527

Post » Wed May 25, 2016 8:09 pm

B
22
S
4
G
3
Posts: 61
Reputation: 2,683

Next

Return to How do I....?

Who is online

Users browsing this forum: luckyrawatlucky, nahima and 5 guests