I've asked this question before a few hours ago and on anohter discord server and I can't seem to get an answer I can understand. I don't want to sound pushing but I've been trying to solve this but to no avail. I want to design a script for ene,my behaviour in a 2D space. The enemy will walk on a platform at a constant speed, turning around upon hitting a wall or reaching a ledge. To do this, I want the enemy (black) to have a secondary child object (grey). The grey object will stay infront of the enemy, meaning that when the enemy changing direction, the grey object will need to change position. How will I do this, as I am unsure how to position the game object, and make it flip around the parent object. If anyone is available, I would greatly appericiaite, especially if you were available to voice call so I could ask any questions about the answer you provide (I am a beginner so I get confused easily).
#Object moving in relation to another
1 messages · Page 1 of 1 (latest)
The grey object can be a child of the enemy. A child will always follow the parent's transform (position, rotation, scale)
You can flip the enemy by setting the X scale to -1
How do I edit a transform in code
🧑🏫 Unity Learn can offer you over 750 hours of free live and on-demand learning content for all levels of experience! Make sure to check it out at https://learn.unity.com/
None of these seem geared towards what I'm trying to do. Do you mind explaining how to edit an object's transform?
Or providing some code to use as a basis?
The only thing I want to do to the transform is edit the scale
Have you looked at any tutorials at all?
Modifying the transform is a very very basic thing