physics problem when rotating layer

Get help using Construct 2

Post » Sat Jan 07, 2012 2:05 pm

Hi

I have a sprite falling from top and some breaks placed around.
When I rotate the layer of the breaks the sprite is still hitting them
were they originally where before any rotation.

how can i fix that?
B
20
S
5
G
5
Posts: 37
Reputation: 4,072

Post » Sat Jan 07, 2012 3:54 pm

I'm having the same issue with the platform behavior.

It doesn't happen when you rotate the whole layout, or if the sprite and your obstacles are in the same layer.

(But in my case, I still need to have multiple layers :/)Albatr2012-01-07 15:56:49
B
52
S
10
G
8
Posts: 44
Reputation: 9,092

Post » Sat Jan 07, 2012 4:48 pm

Consider that the rotated layer is the object to which the rotation is applied. Only its coordinates and angle are modified.
But for any object that belongs to this layer there is no modification of coordinates or angle, it hasn't moved, its support moved.

The solution I came up with is to use another object type that I spawn under the visual elements. This object type (let's call it CM) is my collision mask. This object has the physics behavior.
Also it is spawned in the same layer as the physical object the player controls.
But the twist is to spawn the CM according to the current rotation of the layer.
This calls for a bit of maths trickery and setting of the project.

A capx
This is the actual system I'll use for the contest. Please learn from it, don't simply rip it off.

It's highly uncommented though, and still a WIP.

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sat Jan 21, 2012 12:56 pm

@Kyatric : Thank you very much for sharing this solution. It is really interesting to see the way you have used trigonometric functions to determine the locations to create collision masks.

I wish you all the best for the competition.
Ramesh2012-01-21 12:59:35
B
21
S
6
G
11
Posts: 30
Reputation: 5,396

Post » Sun Jul 22, 2012 3:35 am

Was this problem ever fixed formally? Would make sense for collision box to move with sprites. I still have the problem with build 99.

I want to make a game based on this rotation, so having this patched up would be great. Sorry if there's already a fix. I've been away for a while. =D
B
60
S
13
G
6
Posts: 22
Reputation: 10,297

Post » Mon Aug 06, 2012 12:41 am

@Ashley

Is this considered a bug, or expected behaviour. I was also wanting to rotate a layer, expecting the collision boundaries to rotate, not remain invisibly behind. I've also had to rotate everything manually, which is a pain.
ImageImage
B
66
S
19
G
121
Posts: 3,195
Reputation: 72,852

Post » Wed Nov 28, 2012 4:14 am

I see I am way behind on this, but as of r110 this is still an issue; I've asked for help several times and people just say, "Post the .capx" It makes no sense at all to move each object, calculate a bunch of math and make a collision mask. (forehead slap) I thought by creating different layers and placing objects on that layer, this would resolve the issue. Nope. Logically it should function as simply as you would expect. Rotate the layer, and all it's objects. Yeah, it does. But the gravity physics also rotates, WTH? No, I only rotated a layer with static objects (solids). Layer0 should remain the default gravity for my avatar.
B
5
Posts: 32
Reputation: 789

Post » Wed Nov 28, 2012 4:19 am

[QUOTE=WildShroom] I see I am way behind on this, but as of r110 this is still an issue; I've asked for help several times and people just say, "Post the .capx" It makes no sense at all to move each object, calculate a bunch of math and make a collision mask. (forehead slap) I thought by creating different layers and placing objects on that layer, this would resolve the issue. Nope. Logically it should function as simply as you would expect. Rotate the layer, and all it's objects. Yeah, it does. But the gravity physics also rotates, WTH? No, I only rotated a layer with static objects (solids). Layer0 should remain the default gravity for my avatar. [/QUOTE]

I'll post my .capx with everything (little commenting) if someone feels they can point out my mistake (don't honestly think it's my mistake)   
B
5
Posts: 32
Reputation: 789


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests