Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 748 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 11 of 16 1 2 9 10 11 12 13 15 16
Re: newton [Re: ventilator] #113141
01/31/08 18:41
01/31/08 18:41
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
thank you so much!! now it works... great

i am so happy that i have polygon collisions now. thats absolutely great!

Re: newton [Re: ello] #113142
01/31/08 18:52
01/31/08 18:52
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
i have one question left (maybe not the last) but when i remove the entity, i guess i have to remove it from newton, too?? how do i do this?

Re: newton [Re: ello] #113143
01/31/08 19:03
01/31/08 19:03
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
NewtonDestroyBody()

you additionally could use NewtonBodySetDestructorCallback() to set a function which gets called when you use NewtonDestroyBody(). in the callback you could do the ent_remove() and other cleanup things if necessary.

Re: newton [Re: ventilator] #113144
01/31/08 19:12
01/31/08 19:12
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
now my function looks like this:
Code:

void erdbeere()
{
NewtonBody *body;
c_updatehull(me,0);
set(my,POLYGON|FLAG2);
while(my.z>-50)
{
wait(1);
}
NewtonDestroyBody(nworld, body);
// ent_remove(me);
}



this however leads to an engine crash with no further explanation

btw, how do i setup such a Callback? Never did this before

Re: newton [Re: ello] #113145
01/31/08 19:31
01/31/08 19:31
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
hm... in your function you don't create the body? newtondestroybody() will crash if you don't pass a valid body.



you know how callbacks work from ent_create() for example.

function mycallback()
{
}

ent_create("model.mdl", nullvector, mycallback);

it's just a normal function. the pointer of this function gets passed to ent_create() and ent_create() will call that function then.

many newton features also work with callbacks.

Re: newton [Re: ventilator] #113146
01/31/08 19:39
01/31/08 19:39
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
oh, thanks.. i now use this function and it works:
Code:

void erdbeere()
{
NewtonBody *body = newton_addentity(me, 10, NEWTON_CONVEXHULL, onforceandtorque);
NewtonBodySetVelocity(body, vectorf(0,0,-5));
c_updatehull(me,0);
set(my,POLYGON|FLAG2);
while(my.z>20)
{
wait(1);
}
NewtonDestroyBody(nworld, body);
ent_remove(me);
}



thanks again for your help

Re: newton [Re: ello] #113147
01/31/08 20:06
01/31/08 20:06
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
me again...

now i want to add a random force or torque to the entity and was using this:


NewtonBodyAddForce(body, vectorf(random(100)-50,random(100)-50,random(100)-50));

or

NewtonBodyAddTorque(body, vectorf(random(100)-50,random(100)-50,random(100)-50));

but nothing changes. also i dont get the idea about how to have the entity with a certain start rotation

ok, now i used NewtonBodySetOmega and that works. Guess i'll search for a general newton manual now

Last edited by ello; 01/31/08 20:49.
Re: newton [Re: ventilator] #113148
02/01/08 12:35
02/01/08 12:35
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
yes, thanks very much ))
i really forgot about QUANTTOMETER


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: newton [Re: VeT] #113149
02/02/08 21:00
02/02/08 21:00
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline

Serious User
VeT  Offline

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
that works just great!!!

Code:
 
if (c_trace(camera.x, temp_vec.x,IGNORE_ME|IGNORE_PASSABLE|IGNORE_PASSENTS) > 0)
{
if (you.skill99!=0)
{
vec_for_vertex(temp_vec.x,you,hitvertex);
body_temp=you.skill99;
NewtonAddBodyImpulse(body_temp, vectorf(-normal.x,-normal.y,-normal.z) , vectorf(temp_vec.x * QUANTTOMETER, temp_vec.y * QUANTTOMETER, temp_vec.z * QUANTTOMETER) );
}



but box is rotating only in right side... i dont think that its famous error, but maybe you get this before?


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: newton [Re: VeT] #113150
02/02/08 21:21
02/02/08 21:21
Joined: May 2002
Posts: 7,441
ventilator Offline OP
Senior Expert
ventilator  Offline OP
Senior Expert

Joined: May 2002
Posts: 7,441
please explain what you want to achieve in more detail.

Page 11 of 16 1 2 9 10 11 12 13 15 16

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1