4 registered members (M_D, AndrewAMD, Quad, Ayumi),
806
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
how to attach sprite entity to model?
#311008
02/18/10 07:53
02/18/10 07:53
|
Joined: Dec 2009
Posts: 71
ncc1701d
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 71
|
can someone show me how to attach a sprite entity to the model?
my attempt was doing it like a camera but this may be wrong. I think using vectors is wrong but Iam not sure of the alternative. This crashes in attach_entity()
here are the key parts below thanks
//////////////////////////// void attach_entity();
box = ent_create ("boat.mdl", vector(-400, 0, 570), attach_entity); //
ent_explo = ent_create("flash+3.tga", vector(-200, 0, 0), lightcolor);
void attach_entity() { while(1) { vec_set(ent_explo.x,my.x); vec_set(ent_explo.y,my.y); vec_set(ent_explo.z,my.z); wait(1); } }
|
|
|
Re: how to attach sprite entity to model?
[Re: ncc1701d]
#311013
02/18/10 08:12
02/18/10 08:12
|
Joined: Apr 2006
Posts: 624 DEEP 13
badapple
User
|
User
Joined: Apr 2006
Posts: 624
DEEP 13
|
nevermind matt got ya at the same time
Last edited by badapple; 02/18/10 08:14.
|
|
|
Re: how to attach sprite entity to model?
[Re: Matt_Coles]
#311490
02/20/10 00:57
02/20/10 00:57
|
Joined: Dec 2009
Posts: 71
ncc1701d
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2009
Posts: 71
|
what is wrong with how I applyed what said? I just took the sample moving ball from the the tutorial. You can sub my tga with anything if you want to test it out. I was trying to attach the entity to the ball.
/////////////////////////////////////////////////////////////// #include <acknex.h> #include <default.c> #include <atypes.h> ///////////////////////////////////////////////////////////////
VECTOR ball_force; ENTITY* ball; var timetocallsprite; BMAP* bmp_explo = "thrpink3+3.tga"; ENTITY* ent_explo;
function yourscript() { while(1) { if (timetocallsprite == 1) { ent_create("thpink+3.tga", vector(my.x, my.y, my.z), NULL); ent_explo.roll = 0.001; } wait(1); } }
function main() { level_load("roller.wmb"); ball = ent_create ("ball.mdl", vector(-400, 0, 100), yourscript); ph_setgravity (vector(0, 0, -386)); phent_settype (ball, PH_RIGID, PH_SPHERE); phent_setmass (ball, 3, PH_SPHERE); phent_setfriction (ball, 80); phent_setdamping (ball, 40, 40); phent_setelasticity (ball, 50, 20); while (1) { ball_force.x = 150 * time_step * (key_cur - key_cul); ball_force.y = 150 * time_step * (key_cuu - key_cud); ball_force.z = 0; // phent_addtorqueglobal (ball, ball_force); camera.x = ball.x - 300; camera.y = ball.y; camera.z = 1000; camera.tilt = -60; wait (1); } }
|
|
|
|