Placement system: How to keep the objects snapped correctly to the tycoon's axis

Sorry if this isn’t clear. For clarification just ask me in replies!

So basically, how do i keep the objects perfectly snapped to the rotation of the tycoon?

(Imagine this is my tycoon after I rotate it)

(should be like this)

Any idea on how to do that? Currently my tycoon operates on the world axis, is there a way to do that without changing everything in my code?

You can just make a rotate function that would rotate the item for 45 or 90 degrees after pressing the R key or something like that.

thats not what this thread is about.

I don’t want to rotate an item, I want to snap it’s rotation or axis to the tycoon’s axis

in simplification:

  • If the entire tycoon is rotated by 5 degrees to the right, every item that I want to place should also be snapped to that axis, making it rotated by 5 degress to the right aswell.

could anyone help me with this?

A simple solution would be having an orientation value for each tycoon’s rotation. I’m assuming each tycoon has a different orientation. When deciding the orientation of the model you want to place, you would set the tycoon’s orientation to the model and add whatever rotation it should be to align with how you want it placed (15/30/45/etc degrees rotated).

I would opt for having a basic part to visualize the orientation of the tycoon that can’t be interacted with (Transparency=1 and CanCollide=false).

isn’t that kind of inefficient?

In terms of the method or performance? It definitely isn’t an intensive method and I see no other obvious way to have the same behavior. I’ve done something similar before and I had no issues with it.

Edit:

I still personally prefer the first solution I mentioned. Is your placement system tile-based? I can think of another solution but it does depend on how you have your system set up, so I’m curious how you implemented it.

it uses a grid, but it’s not using tiled floors. (I’m greedy meshing the floors together so that one floor can be lower than others)

If it’s not perfomance heavy or anything, i might just go with what you said.

Maybe check the rotation of a specific part in the tycoon like the primary part or a hitbox?