N
N
Nicholas2016-06-26 07:41:52
Unity
Nicholas, 2016-06-26 07:41:52

What is the principle of creating simplified physics in the game?

interested in creating an analogue of physics from scratch (only so that the hero does not pass through walls, etc. ..)
what is the least resource-consuming method?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maaGames, 2016-06-26
@ACCNCC

If the overall container of the character began to penetrate through the wall, then you move the character along the normal to the wall to the penetration depth so that it stops penetrating. Simplified than this would be just checking the dimensions of the character with the dimensions of the wall, but then all the walls must be aligned to the global coordinate system.

X
xmoonlight, 2016-06-26
@xmoonlight

The most real: read of. documentation.
As simple as possible: keep a map of all impassable static objects, including walls, in memory and check for possible intersection before moving. If there is an intersection, we shorten the displacement vector to a direct intersection with the object and move the object there.
The question is that if there are moving impassable objects, then you will still have to check the intersections geometrically and radially, calculating the inscribing of a circle (ball) into a polygon (polyhedron). That's why it's a bicycle. The standard means of the "engine" will cope unambiguously faster.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question