Answer the question
In order to leave comments, you need to log in
[Unity] Create an object in the player's place. How to do?
I recently started to explore the world of programming. I decided to implement a small 2B project.
As planned: The player controls the square, and there should be a solid wall behind the square.
Example: A square stands on point "B" --> It is moved by one conventional unit
--> Another static square appears on point "B", with the same dimensions.
The controlled square cannot collide with them.
Attached a gif I made for myself. (Ignore the "snakes" in the middle. They should act as other objects colliding with the wall)
Please write the code, and the conditions necessary for the code to work.
I think the code is very simple, but with my knowledge, even such a code is very complex.
Answer the question
In order to leave comments, you need to log in
Just like answering the question in the title
Instantiate (cubePrefab, playerLastPos, Quaternion.identity);
//cubePrefab - ссфлка на префаб куба)
// playerLastPos - Vector3 - позиция игрока (куба),сохраненная при прошлом вводе
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question