How to rotate Layer with cursor position

2023-10-09 23-24-26

The green and red objects are on the layer that needs to be rotated.

As you can see, it can rotate. But why does it spin in the opposite direction? How can I fix this?

Try giving it negative speed

Wait not i am wrong

Negative number would change rotation if you would use rotate action

The triangle is always going to rotate towards the cursor. The camera rotates in the same direction as the triangle. This means any object appears to rotate in the opposite direction because it is positioned relative to the camera.

To understand this better, try it with the camera on your phone. Put your phone in landscape mode so your eyes line up along the length. Then slowly spin the phone around, and keep your eyes in the same position relative to the phone (i.e. spin your head along with the phone). The scene on the phones camera rotates in the opposite direction relative to the screen.

My question is why do you need the whole layer to rotate? Do you just need the red and green objects to rotate with the triangle? If so, use the sticker extension on them, and save yourself a headache in logic.

because it is necessary And rotating the entire layer is easier and less of a problem. But right now I’m only having this problem.

I use Player _Mark as the layer direction indicator. Because I can’t rotate the layer directly. So I have to rotate the object. and let the layers rotate accordingly

You may think that, but there may be a much simpler solution to your problem if it’s tackled from a different angle. Could you explain why you think it’s necessary and what you’re trying to achieve? We may be able give a simpler solution.

Except it could become quite an issue, especially if movement is involved.

I want to make “Modular Design” system ,like game 'Core Craft". But it requires more freedom of movement than scrolling left-right, up-down.

Corecraft - pixel invaders?

TLDR; use the sticker extension. It’s is perfect what you’re after.

Long explanation:
Rotating the layer is definitely not the way to go. Think of it this way. The modules are facing down the screen in their layout, so that they fire to the bottom of the screen.

When the layer camera is rotated, the modules are still facing downwards in the scene, but their presentation is changed and, just for example, now facing to the right. A module fires a projectile. It appears to be firing across the screen, but in reality (in the scene/game world) it’s firing down the scene. The display does not match what is actually happening.

When the projectile appears to collide with an enemy on the right of the screen, in the scene it’s actually miles off - the projectile is hurtling downwards, while the enemy is on the right.

Using the sticker extension, you place the module, stick it to the player and that’s it. The sticker extension will rotate the module relative to it’s position to the player. When it’s facing to the right, it is also facing to the right in the scene, and firing to the right is actually to the right.

you mean this ?

This is what I’m doing. But it seems like this extension does it all for me. I need to spend some time researching this extension. to be able to use normally Because most of my system is already built.

Thank you for your advice.

1 Like