|
|
Computing Player and A.I Normals for Cyberplanets(For Delinkx)
#262851
04/26/09 16:52
04/26/09 16:52
|
Joined: Aug 2003
Posts: 63
Vampyr1
OP
Junior Member
|
OP
Junior Member
Joined: Aug 2003
Posts: 63
|
Hello I am trying to make a game where player and a.i charectors fight on actual cyberplanets rather than dynamic terrain. George Pirvu told me that I would have to ust compute the normal of each object and move them in the direction of their normal - that will make them move towards the center of the sphere, keeping them on the surface. The thing is I don't know where I would 1) put the vec_for_normal (VECTOR* vector, ENTITY* entity, var number); instruction and 2)compute the normal of each object to make them walk on the sphere. Can you help me with this please? thank you
|
|
|
Re: Computing Player and A.I Normals for Cyberplanets(For Delinkx)
[Re: Vampyr1]
#262856
04/26/09 17:31
04/26/09 17:31
|
Joined: Mar 2003
Posts: 3,010 analysis paralysis
NITRO777
Expert
|
Expert
Joined: Mar 2003
Posts: 3,010
analysis paralysis
|
2)compute the normal of each object to make them walk on the sphere.
You wont compute the normals of the moving objects, you will compute the normals of the planet-sphere. the planet-sphere will have a normal for each polygon that makes it up. The sphere is made of many polygons, right? On each polygon that makes the sphere will have a normal to compute. the normal of each polygon of the sphere will be perpendicular to that polygon which makes it the perfect vector (the normal vector) by which you need to align your moving objects.
|
|
|
Re: Computing Player and A.I Normals for Cyberplanets(For Delinkx)
[Re: Vampyr1]
#262989
04/27/09 11:36
04/27/09 11:36
|
Joined: Jul 2008
Posts: 553 Singapore
delinkx
User
|
User
Joined: Jul 2008
Posts: 553
Singapore
|
yes as nitro said, u need to compute the normal at the point where your entity is resting his foot. using the direction of this normal, u need to orient ur entity towards it. ur ground normal is given by the vector "normal" this is a lite-c snippet maybe can convert to c-script (sorry am not too familiar with c-script).
function place_me_on_ground
{
vec_set(temp, my.x);
temp.z -= 1000; // 1000 Quants down
c_trace(my.x, temp, IGNORE_ME);
vec_set(my.x, target); // put on surface
vec_to_angle(my.pan, normal); // look upwards
}
since we dont have a vec_to_normal, the above uses the c_trace to get the angle.
|
|
|
|