Vectors

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Vectors

Post by BraX »

Is there a way to change irrlicht units into quake 3 units?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Code: Select all

#define irrUnits q3Units
:roll:
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Post by BraX »

Do i need to recompile irrlicht or i need to put this into my game?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Argh :x
There is no such things like "Irrlicht units" or q3 units. You can put this code anywhere, it won't do anything. Simply adjust the parameters of your scene or your modelling tool in order to get models and scenes which fit.
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Post by BraX »

well its pain for me, for example 64 q3 units are near 25 in irrlicht.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Then scale your q3 map by 2.something when loading it into Irrlicht. Should be the same size as you expect it then.
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Post by BraX »

Okey ill try that, can you take look at my 2nd thread http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=40332 ?
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

hybrid wrote:Argh :x
There is no such things like "Irrlicht units" or q3 units.
Hehe, you really have to stop doing this; remember the high-security-source-code-download-server story? ;)
Never take advice from someone who likes to give advice, so take my advice and don't take it.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

Get a list of all nodes in your scene and explicitly scale them with this function

Code: Select all

void setNodeHeight(irr::scene::ISceneNode* const node, const irr::f32 requiredHeight)
{
	const irr::core::aabbox3df& nodeBox = node->getBoundingBox();
	const irr::f32 nodeHeight = nodeBox.getExtent().Y;
	const irr::f32 nodeScale = requiredHeight/nodeHeight;

//	printf("Required height: %f\n", requiredHeight);
//	printf("Node height: %f\n", nodeHeight);
//	printf("Scale factor: %f\n", nodeScale);

	node->setScale(irr::core::vector3df(nodeScale, nodeScale, nodeScale));
	node->updateAbsolutePosition();
}

Code: Select all

irr::scene::IMeshSceneNode* sydney = smgr->addMeshSceneNode(sydneyMesh->getMesh(0));

const irr::f32 SYDNEY_REQUIRED_HEIGHT = 1.8f; //units
setNodeHeight(sydney, SYDNEY_REQUIRED_HEIGHT);
This example would scale the node to be exact 1.8 units in height.
What kind of units? Well, could be meters, yards, light-years. You decide.
The important thing is, that you scale objects relative to others.
"Whoops..."
BraX
Posts: 36
Joined: Fri Jul 16, 2010 4:39 pm

Post by BraX »

One more question, i was looking in tut 7 (collision) and i didn't found info about adding collision to 2nd node, i want my player to collide with BSP and with spawned mesh, how to?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Bate wrote:
hybrid wrote:Argh :x
There is no such things like "Irrlicht units" or q3 units.
Hehe, you really have to stop doing this; remember the high-security-source-code-download-server story? ;)
Haha :twisted: That's where I get my regeneration from :wink: These things suddenly come to my mind, and I cannot resist...
Post Reply