that's the problem. i didn't get so far. currently i'm trying to make my model be vehicle joint

[code]
#include <acknex.h>
#include <default.c>
#include <d3d9.h>

// newton works with meters!
// 1 meter = 32 quants
float QUANTTOMETER = 0.03125;
float METERTOQUANT = 32;

#include "newton.h"
#include "matrix.c"
#include "newton_main.c"
#include "newton_debug.c"


ENTITY* n_world;
//ENTITY* car_body;
ENTITY* car;
ENTITY* cam_ctrl;
//ENTITY* car_joint;

//--------------------------------------------------------------------------------------- onforceandtorque()
// callback which applies gravity to active physics entities
//---------------------------------------------------------------------------------------
void onforceandtorque(NewtonBody* body)
{
float mass, ixx, iyy, izz;
NewtonBodyGetMassMatrix(body, &mass, &ixx, &iyy, &izz);
NewtonBodySetForce(body, vectorf(0, 0, -9.8 * mass));
}

//--------------------------------------------------------------------------------------- quit()
// gets called when the engine closes
//---------------------------------------------------------------------------------------
void quit(){newton_stop();}
function camera_upd();

function drop_it()
{
you = ent_create("car.mdl", camera.x, NULL);
you->pan += camera->pan;
NewtonBody *body = newton_addentity(you, 10, NEWTON_CONVEXHULL, onforceandtorque);
}

function main()
{
fps_max = 120;
video_mode = 8;
//video_screen = 1;

wait(3);
level_load(""); // use an empty level
wait(3);

vec_set(&sun_angle, vector(300, 30, 0));
vec_set(&camera->x, vector(0, 0, 500)); // camera start position
camera_upd();

// add world geometry
n_world = ent_create("newton_playground.mdl", nullvector, NULL);
n_world->flags |= FLAG8; // flag8 -> will be added to world collision geometry

newton_start();
on_close = quit;
on_space = drop_it;

const float updir[3] = {0.0, 0.0, 9.8};

car = ent_create("car.mdl", vector(100,200,500), NULL);
NewtonBody *car_body = newton_addentity(car, 80, NEWTON_CONVEXHULL, onforceandtorque);
NewtonJoint *car_joint = NewtonConstraintCreateVehicle (n_world, &updir[0], car_body);
}


function camera_upd()
{
VECTOR cam_move;
cam_ctrl = ent_create("ball.mdl", vector(0,0,300), NULL);
set(cam_ctrl, INVISIBLE | PASSABLE);

while(1){
cam_move.x = (key_w - key_s) * 40 * time_step;
cam_move.y = (key_a - key_d) * 30 * time_step;

c_move(cam_ctrl, cam_move, nullvector, NULL);

cam_ctrl.tilt += mouse_force.y * 15 * time_step;
cam_ctrl.pan -= mouse_force.x * 15 * time_step;

vec_set(camera.x, cam_ctrl.x);
camera.tilt = cam_ctrl.tilt;
camera.pan = cam_ctrl.pan;

wait(1);
}
}
[code/]

Last edited by cerberi_croman; 05/13/08 14:57.


Ubi bene, ibi Patria.