Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 1,085 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[NEWTON] NewtonBodySetForce #243279
12/29/08 08:34
12/29/08 08:34
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline OP
Senior Member
kasimir  Offline OP
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
Hi,
i started with Newton, and i would ask if it is possible to set forces outside the callback function?
so i can use it like NewtonBodySetVelocity in each other funtion?

THX kasimir

Re: [NEWTON] NewtonBodySetForce [Re: kasimir] #245773
01/11/09 20:12
01/11/09 20:12
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline OP
Senior Member
kasimir  Offline OP
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
so i did it include into the callback function using 3 skills...

but it does not work this way i like to have it...

i tried to move physic objects with mouse before with ODE - this works nice, but if i do this same way with Newton an object hiting a wall gets stuck / looking not nice...

with ODE this looks still smooth:
Youtube Video - ODE

so how i do this:

-calculate a vector from the clicked object to the 3d mouse position
-clear all velocities
-add force

two examples with Newton:
Youtube

so does anyone know a better way than mine?!

THX KASIMIR

Last edited by kasimir; 01/12/09 19:07.
Re: [NEWTON] NewtonBodySetForce [Re: kasimir] #248256
01/25/09 16:48
01/25/09 16:48
Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
kasimir Offline OP
Senior Member
kasimir  Offline OP
Senior Member

Joined: Dec 2005
Posts: 490
Germany/Berlin-Velten
so i get it work with newton like ode using forces!

but i modified the callback-function this way to add forces, i know thats is not nice frown
Code:
void onforceandtorque(NewtonBody* body)
{
	float mass, ixx, iyy, izz;
	NewtonBodyGetMassMatrix(body, &mass, &ixx, &iyy, &izz);

	ENTITY* entity = NewtonBodyGetUserData(body);
	VECTOR force;
	
	NewtonBodySetForce(body, vectorf(0, 0, - 50 * mass));
		
	force.x = entity.skill20;
	force.y = entity.skill21;
	force.z = entity.skill22;
	
	NewtonBodyAddForce(body, vectorf(force.x, force.y, force.z));
	
	entity.skill20 = 0;
	entity.skill21 = 0;
	entity.skill22 = 0;
	
}


now i am using 3 skills to save forces applied to an newtonobject, but it isn't the best way i like to have...

so does anyone know a better way to solf this problem???

[EDIT]
How can i apply forces out of the center / origin of a physic obect?
I want to drag them with help of the mouse!



Last edited by kasimir; 01/27/09 14:56.

Moderated by  HeelX, Spirit 

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