Posted By: ncc1701d
problem understanding c_trace and vec_dist - 03/01/10 09:27
newby here
can someone take a look at this and tell me what I am doing wrong? I am just trying to use c_trace and vec_dist for the first time. I am trying to display the distance between 2 balls using those 2 types of code tools. thanks
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>
////////////////////////////////////////////
var distance = 0;//ok
ENTITY* ball1;
ENTITY* ball2;
PANEL* first_pan =
{
digits (30, 30, 2, *, 1, distance);
flags = VISIBLE;
}
function earth()
{
ball1 = my;
my.ambient = 100;
c_trace(my.z,ball2.z,USE_BOX);
distance = vec_dist(my.z,ball2.z);
}
function testball()
{
ball2 = my;
my.ambient = 0;
}
function main()
{
level_load("small.hmp");
ball1 = ent_create("earth.mdl", vector(0, 0, 30), earth);
ball2 = ent_create("testball.mdl", vector(0, 0, 65), testball);
}
can someone take a look at this and tell me what I am doing wrong? I am just trying to use c_trace and vec_dist for the first time. I am trying to display the distance between 2 balls using those 2 types of code tools. thanks
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>
////////////////////////////////////////////
var distance = 0;//ok
ENTITY* ball1;
ENTITY* ball2;
PANEL* first_pan =
{
digits (30, 30, 2, *, 1, distance);
flags = VISIBLE;
}
function earth()
{
ball1 = my;
my.ambient = 100;
c_trace(my.z,ball2.z,USE_BOX);
distance = vec_dist(my.z,ball2.z);
}
function testball()
{
ball2 = my;
my.ambient = 0;
}
function main()
{
level_load("small.hmp");
ball1 = ent_create("earth.mdl", vector(0, 0, 30), earth);
ball2 = ent_create("testball.mdl", vector(0, 0, 65), testball);
}