How to move Anchor Point with code?
-
@Deeeds Move the anchor point of what? Just move the object’s anchor point, or move the anchor point of an object in a behaviour (like Move to Object etc)?
You can’t just move an object’s anchor point, but you can change the anchor point that behaviours select the object with.
-
@Aidan-Oxley I think @Deeeds means being able to set the anchor point while the game is running.
-
@iTap-Development In behaviours, you can. Use set input field or something, but it had to be a behaviour like Move to Object etc.
-
@Aidan-Oxley I'm not understand what you're saying. Sorry. How do you mean, and what happens?
-
HyperPad doesn't have the dynamic changing for anchor points, (Yet?) But you could move the anchor point in the object while selecting it inside a behavior.
-
sorry, dont understand.
-
@Deeeds what they are saying is move type behaviors have anchors you can move when you select the object for the behavior.... however those “anchors” aren’t for making an actual anchor point. Instead they are, for example, used in the ‘move to point’ behavior to select the position to move to. Also, that “anchor” has no effect on rotate behaviors.
-
@iTap-Development Ok, so they're answering a question that's not this question?
-
@Deeeds I think they maybe thought that the “anchor” did what you needed. Which, as far as I can tell, it doesn’t.
-
@iTap-Development I still have no idea what they're talking about. The anchor is a specific feature of any object in a 2D or 3D space. They don't seem to be talking about the anchor.
And yes, you've guessed right, rotation is the issue, around a point that's arbitrary, and dynamic. And gets around the snapping problem of anchor points in the editor.
-
@Deeeds they are talking about the “anchor” that you can drag when selecting an object for a behavior. I think they thought that that anchor could be used to set the anchor for the object, but it is actually used for selecting positions for certain behaviors(and in many behaviors, It does nothing).
I don’t know if you saw my post, but the anchor point seems to be snapping to its own grid relative to the object. So if you rotate the object, the grid gets rotated. I can see that could be useful for some things, and for others not so much. Maybe a toggle is needed?
You could search for, or find in my posts, a thread related to making your own anchor point. It’s kinda a lot of work, but if you need an anchor bad it might help.
-
If you can understand what’s happening in this screenshot, it shows you the only possible ways to ever change an anchor while the project is running, in a behaviour, not the anchor of the object itself.
-
@Aidan-Oxley oh I see what you mean. That anchor is pretty much an offset of the objects real anchor. That won’t help with rotation though.
-
@iTap-Development If you have a Rotate By or a behaviour similar to that, and you set the anchor to something other than 50 50, it will rotate about the anchor you put in.
-
@Aidan-Oxley But you can't set this anchor point, for rotation, with code... right?
-
@Deeeds Yes, using Set Input Field. You know how that works right?
-
@Aidan-Oxley That's not moving the anchor point, that's changing the rotation.
I'm asking if it's possible to move the anchor point with code.
Not a virtual anchor point.
The anchor point.
-
@Deeeds Yes, I’m stupid. Didn’t look at what I was doing. Erm, maybe this doesn’t work for rotations, but it does for Move to Object, or Rotate to Object.