Check Collision in advance

Started by
24 comments, last by Fulcrum.013 5 years, 6 months ago
5 hours ago, Fulcrum.013 said:

Also in case your character have to move along a surface only(i.e. can not jump/fall from borders) you can calculate coords by other way - to move character in current surface u,v coords and then compute a world position substituting current u,v to equation of surface. For planes its very simple to do. Also in case of planar only floor surfaces it  can be easily extended to jumps/falls. You just have to substitute x,y,z of coord of closest to plane point of object to equation of plane to find a distance by normal and then project a 3D velocity to its vector. By other worlds - to add 3-rd dimension to same algo to have a time point on wich jumped/falling object will hit a plane and wich same plane, and ever to advice a coords of hit point. Really floor is same plane as wall but  have other orientation of its normal vector. Only difference betwin walls and floors/ceiling that walls have a zero vertical component of normal, while horizontal floors/ceiling have  a vertical component of normal 1 and other components is 0 for horisontal floor, and much higher vertical then other components for slooped floors. 

i'm sorry i can't get it

Advertisement
Just now, Mirko Rossetti said:

i'm sorry i can't get it

Ok. For understanding how to add 3rd dimension just imagine that you have a plane and  sphere same as line and circle.

Also did you know what term "surface coords" mean?

#define if(a) if((a) && rand()%100)

17 minutes ago, Fulcrum.013 said:

Ok. For understanding how to add 3rd dimension just imagine that you have a plane and  sphere same as line and circle.

Also did you know what term "surface coords" mean?

Yes, you mean the coordinate surfaces right?

I mean u,v coords of your planes. for plane/surface it same as x,y  for 2D. you can just move object into u,v( x,y) of navpoly underleying plane and recalculate it to 3D coords using equation of surface (plane) to render object.

#define if(a) if((a) && rand()%100)

Actually i doesn’t have any udea to how do it.

1 hour ago, Mirko Rossetti said:

Actually i doesn’t have any udea to how do it.

Ok. Imagine a shеet of paper that lies on desk and have a u and v axes on it. You can move a point over  sheet changing a values of u and v. Now lift up a sheet to make a some angle betwin desk and table. It not change ability to move a point over sheet (it coords on basis drawn on sheet still same and have same operations set to move it over sheet), But coords of point in 3D space has changed. So 3D coord of object that placed on some surface depends from u,v coords that relative to basis of its surface  (aka surface coords) and properties of surface determined by equation of surface. Really lifting list up you dont changing a coords of point respectively to surface, you chaning a orientation of plane respectively to space where its surface placed. And to find a 3D coords from u,v coords of some point of surface it required only to substitute u,v to parametrical equation of surface. So you can just move a object placed on plane over its plane and recalculate its 3D point for rendering that is much eaily than move it in 3D and then align it to plane.

Now imagine you have 2 sheets of paper. One of it lies on desk but other lifted up  by some angle and aligned to first sheet along some edge. Obviuosly that second sheet have a other plane equation than first. so to move poiint from first sheet to second you have to recalculate a resulting point from surface coords of first sheet to surface coords of second  sheet. It can be eaily done for points of alligned edge becouse its have same 3D coords for both planes. So you can move your object until central point reach portal edge , then recalculate a u,v respecively to second sheet basis (that require to solve simple equations system) and continue to move object but along second sheet.

#define if(a) if((a) && rand()%100)

This topic is closed to new replies.

Advertisement