Origin point on hitbox

I’m literally going crazy … can you help me please ??? I can’t keep the character turned
I’ll explain better what you see in the picture and the hit box … it will be covered by a character seen from above … I need it to always be turned in the direction of the black point … I put the origin but with the rotate toward position command it does not work … do you have an idea ?? it seems nonsense … but I’m missing something …

Add some screenshots of your character and your events please

sorry i forgot

this have a topdown behavior… and is a hitbox… i want a caracther look a black zone and rotate whit him…

I’m not sure what you mean with the rotation - there are a few ways to interpret that. Could you show with images what you would like to happen - just mockup an example? A couple of images of how you would like it to look when you press the right key and when you press the up key should be a good start.

yes in fact it is a bit difficult to explain … the image you see white with a black dot … would be the hidden base with the behavior top down where then I will position the character hiding that image of the white circle with the black dot … so that you only see the character … when I move that white circle rotates … and the black dot moves in the direction of travel by rotating ok ?? now the character that I attack above is always turned to the right … and I would like it to rotate together with the image following the rotation together with the black dot … consider that it is a game seen from above …

the red arrow is a carachter… now is in the right direction… if i want go in up a circle whhite rotate and black dot go in top… but a red arrow stay in right… and i want go in top by rotating togheter circle

I think you can best achieve this using the Sticker behaviour. It’s an extension you need to add to your project, and then add the sticker behaviour to your character. Then at the start of the scene, stick the character to the base. And that’s it. When the base rotates, so does the character. When the base moves, do will the character.

1 Like

until now I used this action but if that extension is better why not? so can i extend the usage for everything i have to attack the player or enemies ?? now I see…

I am not sure do you want something to do with that point or your object animation is not following like it should?

IF you mean your object is not rotating on it’s own axis then you messed up origin point and maybe center
If your object image resolution is 10 pixels by 10 pixels then origin point should be at X0 Y0 (top left corner)
And center should be at X5 Y5 (well center and 5 because that is HALF of 10)

Do you mean like this?
When the player rotates that red square rotates around player
Kinda like tank cannon which rotates with tank and not independently

If that’s what you need i simply added extra point to my object (in this case player) like in front of my player and called it ActionPointLeft at least for this animation

Added new object called PlayerHitBox and set it origin point to center instead of upper left corner
So if PlayerHitBox is 8 by 8 pixels i set X to 4 and Y to 4 which is center

Then i just added ACTION

For it to work i 1st needed to add PlayerHitBox object to scene just like i did the player

I used program called ShareX https://getsharex.com To make that gif which as you see helps to explain what is the issue

Thanks for your kind reply
you hit the target when you say like the turret of a tank … what I want to achieve are 2 objects that rotate exactly like a turret of a tank only that the turret must be fixed … that is … rotate together with the tank while maintaining a fixed point

Ok now i don’t understand did my method helped you or not?
If not then in what position to each other are 2 objects?
Or even better show us screenshot of your objects

this forum does not allow me to attach 2 screens …
anyway and as I told you …
imagine a tank with the cannon divided into 2 pieces … one the base and the other and the cannon … the base will be the hitbox … the cannon instead will be a character … if I leave my hit box visible I noticed that the character does not rotate with the base and I would like it to rotate with the base
in short … you have to imagine a tank that has a fixed turret … 2 isolated pieces that move together … clearly I have the central points of origin to the images

Print Screen then Ctrl + V
This is how i made it

New Piskel

a poiint 1 is my hitbox whith topdown behavior… as you can see if you move it whit the keyboard… rotate… cause in need rotation when i move… in behavior you have a option

a black square number 2 is my carachter… he look at right… i figure it whit blue…


when i attach square on the circle on the center whit origin point… a cirle do a rotation but a square not!! i want square rotate tigether circle

I got the answer you need i will give it under my questions
1 - If tank is divided into 2 parts but both tank and cannon need to rotate together then what’s the point of having it as 2 separate objects?
2 - Does cannon extend the tank? Like normal cannon in tank if you look from top then when tank ends cannon is a bit longer

Option A to achieve your goal
MAKE IT SAME OBJECT/IMAGE and not 2 separate objects/images

Option B
Image of tank needs to have same size as image of cannon and they need to have exact same origin point and center
So if let’s say
Tank is Black
Cannon is White
Center of axis is Red
End/Travel path of axis is Green
Then Blue (SIZE With and Height) of both images/objects needs to be the EXACTLY the same

And i think that is your issue center of image of your cannon is not center of image of your tank
Or they are different size which will result in same thing i described in line above
2 separate objects rotation on same axis

I gave them both topdown movement and spawned on same grid cannon on top of tank
Then just moved left and right
That’s why you see my actual player on the right moving left and right
In your case however your tank is moving then cannon have to be moved with exact same method and it will work

So again i don’t understand why you need 2 separate objects and images? Makes no sense to me
And if is like you attach your character to your tank and then character is in front of tank
Then if you put 1 image over another then both need to have same size so taking your image

Where red is tank and black is character
A is what you want to achievie
B is how tank alone should look on a image
C is where character should be on image
Where white dot on tank is center of image and purple dot in upper left corner is origin point

If you rotate the HitBox, you also need to rotate the character. The character doesn’t magically rotate. It doesn’t know about the HitBox.

But, more importantly, have you tried the sticker extension & behaviour?

Here’s the code :


And here’s what it does :


exactly what you sent now …

the hitbox walks randomly around the map … and it is clear that a character is looking in the direction he walks … that’s why I have no instructions for it … but if I approach you with the player he turns and runs after you … but when this happens … the enemy looks at random … as sometimes some enemies are born by going left and looking right … they don’t follow the direction of the hitbox

Does the enemy/character start facing the same way as the hitbox? What are the events you have for creating the enemy, and for moving them/the hit box?

no … the view is totally randomized I noticed that only the first enemy is born looking in the same direction then the others do at random … these are my instructions …
I also sent you a private message …