Gamestudio Links
Zorro Links
Newest Posts
Bug in train mode, or it seem to me
by mistery. 09/24/26 17:34
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 09/22/26 12:21
Capital slider is not saving in Z12
by Petra. 09/22/26 06:49
Parent/child object
by VoroneTZ. 09/22/26 05:52
Zorro tutorial ideas?
by AndrewAMD. 09/21/26 14:50
Trades during a running bar
by Martin_HH. 09/21/26 12:03
Avoiding pop-up training parameter results
by Martin_HH. 09/16/26 21:31
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (mistery), 8,494 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Opus, Jubilee, lopezsergio07, mistery, lokkalyansamiti
19239 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 | 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