I’m making an object that my player can push to complete puzzles and stuff, and one thing I noticed is when I want it to be exactly one tile in the y axis (the same height of the object), it has a little wiggle room and when pushing it from the top or bottom, it wiggles and jiggles. Is there a way I can lock its movement to just the x axis, preferably without code?
If you need to move something only along a single axis, then you likely don’t need a rigid body simulation at all.
Well it won’t always only move along a single axis. Its only this specific instance. Also how would I make a pushable body without a rigidbody? (Geniune question)
Define “pushable”. For example in a classic Sokoban game you push things around all the time but none of it is done via rigid body simulation. It’s much simpler.
For this game, a pushable object is an entity which when the Player runs into it, it moves along with it, free from a grid, in both directions. Friction would be infinite (so it only moves when you move) and does not rotate. When it is up against a wall/a point it cannot travel past, it would block the player from moving so it also functions as an obstacle.
That sounds like it’s doable by simply adjusting the position via script.
If you don’t need physics, maybe detecting the collision and lerp the movemenet on one direction will be enough.
If I wanted to do this, what body would you recommend me to use, and then how would I detect if my character is pushing it but it also be able to function as an obstacle?
If it were to move tile based, like Zelda I’d for sure do this, but I don’t think lerping it would work as it would just move with the character and stop, even in-between tiles.
Is it a grid based movement? Can you point at an existing game that uses the same or similar type of movement?
It is not grid based movement. Undertale is a great example, as I’m modeling the pushable objects very closely to it, specifically the rocks early game.
Can you show an example video?
it doesn’t show case it here but you can move it both towards the button and away from the button in the x axis.
Oooh, I just had an idea. Would it be possible for me to bind an object to a path and allow the character to move it along that path?
Like attaching the box to an invisible string that cannot bend, so its movement is only the path I want it to be able to take. That and it also deattach from that path if I want it to have total free movement.
I tried experimenting with this and I don’t know if its possible the way I want, since I’d want it to act like a guide rail. It can freely move, but only along the rail.
You lerp between positions. The lerp is to avoid teleporting it.
You can use character body.
from there, how would I be able to push it along the path? I know I could use progress however I don’t think detecting whether it would go forward or backwards would be easy, especially if it can turn a lot.
Your original question was to push it along a single axis. How this suddenly turned into pushing it along a path? Your reference video doesn’t show any push along paths.