IrrNewt irrlicht\newton framework >> SVN access

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
kburkhart84
Posts: 277
Joined: Thu Dec 15, 2005 6:11 pm

Post by kburkhart84 »

BlindSide wrote:Stop this childish bickering at once....lol
I know...right. I wasn't trying to start any problem, I just thought the tiger might be interested in knowing. I don't think SIO did anything wrong or I would've had said so in my original post. I had been looking at IrrSpintz and was thinking about whether a newton wrapper was going to be ported or possibly doing it myself anyway. It is a good thing and I don't think the tiger has a problem with it, unless it continues with childish bickering.......
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

I guess what I'm asking is are the "newton::ICar->turnRight();" and "newton::ICar->turnLeft();" functions framerate independant?
you're right. try to fix it
Also, while I'm here, how would I make a vehicle have more than 4 wheels? I want to make a tank and I want it to have 8 wheels (4 on each side) so that it reacts realistically. And if it's possible, instead of turning the front two wheels to steer, i want to be able to make the wheels on the left side turn separately to the ones on the right side.
create a simple vehicle (IWorld::createVechicleSimple()) add the tires you want (IVechileSimple::addTire()) and rotate (setOmega) or move (setTorque) every tire you want manually
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

Done and done...I think...

I changed the turnLeft(), turnRight() and noTurn() functions so that the number passed to addSteerAngle() is multiplied by IWorld->getTimeElapsed(). I know it seems obvious to change addSteerAngle() rather than those 3, but I couldn't get IWorld from IVehicleTire, there's probably a way, but I just can't figure it out at the moment :D

Those functions look a bit like this now, and I also fixed them up so turnLeft() actually turns left and turnRight() actually turns right :lol:

Code: Select all

inline void turnRight() {
	//this->fr_tire->addSteerAngle(-this->steer_angle_increment);
	this->fr_tire->addSteerAngle(this->steer_angle_increment * this->getChassis()->getWorld()->getTimeElapsed());
	this->fl_tire->addSteerAngle(this->steer_angle_increment * this->getChassis()->getWorld()->getTimeElapsed());
}

inline void turnLeft() {
	//this->fr_tire->addSteerAngle(this->steer_angle_increment);
	this->fr_tire->addSteerAngle(-this->steer_angle_increment * this->getChassis()->getWorld()->getTimeElapsed());
	this->fl_tire->addSteerAngle(-this->steer_angle_increment * this->getChassis()->getWorld()->getTimeElapsed());
}

//set steer angle gradually to 0. how gradually depends on steer angle increment
inline void noTurn() {
	irr::f32 steer = this->getFRTire()->getSteerAngle();

	if(steer<0)
	{
		steer = this->steer_angle_increment;
	}
	else if(steer>0)
	{
		steer = -this->steer_angle_increment;
	}
				
	steer *= this->getChassis()->getWorld()->getTimeElapsed();

	this->fr_tire->addSteerAngle(steer);
	this->fl_tire->addSteerAngle(steer);
}
EDIT EDIT: Fixed it, changed the noTurn function to the one above and the larger numbers I have to use for steer_angle_increment work fine. I'll work on having 8 wheels later (it seems simple enough to do, just do what you said and use some custom fuctions for turning), I want to put a small vehicle demo together first, think a skate park, but with a little box-car :D

Thanks for your help
Tell me what you cherish most. Give me the pleasure of taking it away.
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

I'm still working on my little vehicle demo at the moment, I'm just trying to make it a little more interesting that just hitting a few jumps by adding a height, distance and time in air meter.

The only problem is that the IVehicleTire::isAirborne() function returned 0 whether the tire was on the ground or not. I had a look at the source code but I couldn't find a way to fix it, so I went to newton and found the NewtonVehicleTireIsAirBorne() function, and thanks to ICcar::getNewtonJoint() and IVehicleTire::getNewtonTireID() I've got a working isAirborne() function that looks like this (it checks if all 4 wheels of the ICar are airborne):

Code: Select all

bool isAirborne(newton::ICar* carBody)
{
	if (NewtonVehicleTireIsAirBorne(carBody->getNewtonJoint(), carBody->getFRTire()->getNewtonTireId()) == false)
	{
		return false;
	}
	if (NewtonVehicleTireIsAirBorne(carBody->getNewtonJoint(), carBody->getFLTire()->getNewtonTireId()) == false)
	{
		return false;
	}
	if (NewtonVehicleTireIsAirBorne(carBody->getNewtonJoint(), carBody->getBRTire()->getNewtonTireId()) == false)
	{
		return false;
	}
	if (NewtonVehicleTireIsAirBorne(carBody->getNewtonJoint(), carBody->getBLTire()->getNewtonTireId()) == false)
	{
		return false;
	}
	return true;
}
Also, is there any chance that there's going to be an IrrNewt 0.4 any time in the future? Or is there nothing left worth adding?
Tell me what you cherish most. Give me the pleasure of taking it away.
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

Thanks for the pathes :D

For the first path that make turnLeft and turnRight frame rate indipendet i'm agree nad put it in the next release :D

for the last patch i don't agree with you. If you take a look at Newton documentation for NewtonVehicleTireIsAirBorne , it says
This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
in fact IrrNewt calls it in irr::newton::Hidden::VehicleTireCallBack. You don't call this function in the tire callback, so I think that maybe this is not good solution?

I don't know if it is bugged, but it should be called there :wink:
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

Also, is there any chance that there's going to be an IrrNewt 0.4 any time in the future? Or is there nothing left worth adding?
i've added ragdoll , compound collision (by re-write the code that create bodies to do this) and some minor adding (like speed up setScale).

But I don't know when i'll release it. There is a bug now. I can't promise nothing. Also currently I don't have much time to work on this :wink:
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

Please do keep working on it. What you've done so far is very helpful!
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

white tiger wrote:for the last patch i don't agree with you. If you take a look at Newton documentation for NewtonVehicleTireIsAirBorne , it says
This function can only be called from the vehicle update call back. It can be used by the application to generate the custom vehicle dynamics.
in fact IrrNewt calls it in irr::newton::Hidden::VehicleTireCallBack. You don't call this function in the tire callback, so I think that maybe this is not good solution?

I don't know if it is bugged, but it should be called there :wink:
You're probably right, but it's working fine for me at the moment and that's all I wanted, a temporary solution is better than none at all :D

And as for the first code, glad I could help out.

EDIT: There's also a small bug in the car example that I only picked up on recently. The following code gets the center of mass and multiplies the y by 0.5f, the problem is that centre_mass.Y is 0, so centre_mass.Y *= (0.5f*NewtonToIrr); is always going to be 0 :D

Code: Select all

	core::vector3df centre_mass = chassis_p_node->getCentreOfMass();
	centre_mass.Y *= (0.5f*NewtonToIrr) ;
	chassis_p_node->setCentreOfMass(centre_mass);


I figured it out when I was messing around with my car and noticed that changing that 0.5f to something else didn't make a difference. That and I noticed trying to lower the center of gravity was doing some wierd things to my car, so it's staying at core::vector3df(0.0f, 0.0f, 0.0f) for now...
Tell me what you cherish most. Give me the pleasure of taking it away.
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

I found the bug. Go in hidden.cpp, function VehicleTireCallBack, you'll find those lines

Code: Select all

//is air borne
		//warning if I cast an int into bool

		switch(NewtonVehicleTireIsAirBorne(
			tires[i]->n_vehicle,
			tires[i]->tire_id)) {

		case 1: tires[i]->is_air_borne = true;

		default: tires[i]->is_air_borne = false;

		}
as you can see I forgot the breaks, so the default statement is always executed :) fix it now :D
The following code gets the center of mass and multiplies the y by 0.5f, the problem is that centre_mass.Y is 0, so centre_mass.Y *= (0.5f*NewtonToIrr); is always going to be 0
:oops: i've taken it from the newton car example :lol:
olivehehe_03
Posts: 157
Joined: Tue Mar 20, 2007 8:30 am

Post by olivehehe_03 »

Nice fix, I never thought to look there to find out what was wrong, but I've fixed it and recompiled so everything is good until we find something else wrong :D
Tell me what you cherish most. Give me the pleasure of taking it away.
DavidR
Posts: 34
Joined: Sat Jul 15, 2006 5:12 pm

Post by DavidR »

compound collision (by re-write the code that create bodies to do this)
Ah, superb :) I was about to start writing my own method to do it via Newton, but having compound collision would be very useful, and saves me a lot of time (yes, it was compound collision I was thinking about, by the way, in my earlier post)

Thanks very much for implementing :)
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

hey

Post by beshrkayali »

This version of IrrNewt is compiled using irrlicht 1.1, but you can compile
the source also for 1.3. go here

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=17698

for pre-compiled irrlicht 1.3 version
where is the pre-compiled irrlicht 1.3 version?
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

where is the pre-compiled irrlicht 1.3 version?
I think I won't release a 0.3 version compiled with 1.3, sorry. You can do that by yourself.

You can simply compile it with 1.3. You need only the newton library and of course irrlicht 1.3. Also there are projects for vc++ and dev-c++ in the source\ dir :wink:
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

thanx

Post by beshrkayali »


I think I won't release a 0.3 version compiled with 1.3, sorry.
why??????
You can simply compile it with 1.3. You need only the newton library and of course irrlicht 1.3. Also there are projects for vc++ and dev-c++ in the source\ dir Wink
I tried to compile it, but it's not working. it needs the DirectX9 libraries and it need openGL libraries also. please :? if you can do that, please do it. cuz know that there is plenty of guys who wants to find it already compiled with Irrlicht 1.3 support.

thanx
Kurak
Posts: 7
Joined: Sat Feb 17, 2007 7:26 pm
Location: Poland
Contact:

Re: thanx

Post by Kurak »

beshrkayali wrote:I tried to compile it, but it's not working. it needs the DirectX9 libraries and it need openGL libraries also. please :? if you can do that, please do it. cuz know that there is plenty of guys who wants to find it already compiled with Irrlicht 1.3 support.

thanx
There are some unnecessary #includes in IrrNewt code - I saw it when I tried to compile it with Irrlicht 1.3. I mean, compiller wanted me to give him glut header, but when I've commented line with this #include rest compilled succeesfully and now it works :)
To sum it, I don't have OpenGL libraries and I compilled IrrNewt, so I think you don't have to have DirectX 9 libraries to do it :)

According to topic - I really really enjoy using IrrNewt, and I like it. Thanks :)
Post Reply