newton physics

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Genis
Posts: 4
Joined: Thu Sep 08, 2005 7:06 pm

newton physics

Post by Genis »

I was wondering if anyone had any luck implementing newton physics. I know the .net wrapper is missing many of the MeshBuffer methods needed in the c++ example, but does anyone have a workaround or is it currently impossible without editing irrlicht itself.

Thanks
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

I don't use .NET, I use Newton with Irrlicht and C++. You should be fine to use Newton so long as the .NET mesh buffer has the getMesh() function so you can get its vertices for convex hulls and collision trees. The only other calls Newton needs from Irrlicht are node->setPosition() and node->setRotation(). I think I even saw a .NET wrapper for Newton in their forums (have to check, not sure)
Genis
Posts: 4
Joined: Thu Sep 08, 2005 7:06 pm

Post by Genis »

yea, there is the problem that I see is that irrlicht.net lacks the ability to get the MeshBuffer itself and thus you can't(atleast i dont know how to) get the vertices.
Maverick

Post by Maverick »

Hm, how about implent this yourself and post it here? :)
Genis
Posts: 4
Joined: Thu Sep 08, 2005 7:06 pm

Post by Genis »

lol, thats fine by me, I was just trying to make sure I wasn't missing something
kable
Posts: 3
Joined: Thu Dec 08, 2005 7:49 pm

Post by kable »

I've made a start implementing the mesh buffer stuff, here's the two main files I've added (need to update comments):

IMeshBuffer.h :

Code: Select all

#pragma once

using namespace System;

#pragma unmanaged
#include "..\\irrlicht\\include\\irrlicht.h"
#pragma managed

#include "Vector3D.h"
#include "IMesh.h"
#include "IAnimatedMesh.h"
#include "Box3D.h"
#include "Material.h"
namespace Irrlicht
{
namespace Scene
{
	/// <summary>
	/// An interface for easily manipulating meshes.
	///</summary>
	public __gc class IMeshBuffer
	{
	public:

		/// <summary>
		/// Instead of this use SceneManager.GetMeshManipulator().
		/// </summary>
		IMeshBuffer( irr::scene::IMeshBuffer* realBuffer );

		~IMeshBuffer();

		/// <summary>
		/// returns an axis aligned bounding box 
		/// </summary>
		Irrlicht::Core::Box3D IMeshBuffer::getBoundingBox();

		/// <summary>
		/// returns amount of indices
		/// </summary>
		int IMeshBuffer::getIndexCount();
 		
		int IMeshBuffer::getIndices();

		Irrlicht::Video::Material IMeshBuffer::getMaterial();

		int IMeshBuffer::getVertexCount();

		irr::scene::IMeshBuffer* meshBuffer;

		inline irr::scene::IMeshBuffer* getMeshBuffer()
		{
			return (irr::scene::IMeshBuffer*)meshBuffer;
		}

		
	};

}
}
IMeshBuffer.cpp

Code: Select all


#include "IMeshBuffer.h"
#include "NativeConverter.h"

namespace Irrlicht
{
namespace Scene
{

	IMeshBuffer::IMeshBuffer ( irr::scene::IMeshBuffer* realBuffer )
		: meshBuffer( realBuffer )
	{
		meshBuffer->grab();
	}

	IMeshBuffer::~IMeshBuffer()
	{
		meshBuffer->drop();
	}
	
	//returns an axis aligned bounding box
	Irrlicht::Core::Box3D IMeshBuffer::getBoundingBox() {
		return irr::NativeConverter::getNETBox(getMeshBuffer()->getBoundingBox());
	}
	int IMeshBuffer::getIndexCount() {
		return getMeshBuffer()->getIndexCount();
	}
	int IMeshBuffer::getIndices() {
		int val= (int)getMeshBuffer()->getIndices();
		return val;
	}

	//returns the material of this meshbuffer
	Irrlicht::Video::Material IMeshBuffer::getMaterial() {
		return irr::NativeConverter::getNETMaterial(getMeshBuffer()->getMaterial());
	}

	//returns amount of vertices
	int IMeshBuffer::getVertexCount() {
		return getMeshBuffer()->getVertexCount();
	}

}

}
This class alone is next to useless though... next step is to add the getMeshBuffer() methods for the classes which it is commented out in.... I'll keep any significant progress posted in case it's of use to anyone.
noone

Post by noone »

:D Thank you!
Genis
Posts: 4
Joined: Thu Sep 08, 2005 7:06 pm

Post by Genis »

awesome, thanks for your post. I too will post anything that I do that will help out in this matter
Maverick

Post by Maverick »

Yieeepie :)

(Have you sent nico this?)
Maverick

Post by Maverick »

Hmmmm, I tried to look into this but I am a lil confused.
The GetMesh() function, which format must the return type have?
I would gues a float[] with the coords of the vertice points?
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

getMesh() should return an IMesh, the IMesh contains the vertices, indices and texture coordinates
Locked