A rude request ;)

nargil

16-10-2008 21:27:19

All requests are rude, so here is another one ;)

I'd love to see a NxOgre::ManualShape as a shape.

something like

NxOgre::ManualShape ms;
ms.begin(Ogre::RenderOperation::OT_TRIANGLE_STRIP);
ms.position(0,0,0);
ms.position(0,1,0);
ms.position(0,1,1);
...
ms.end();


I know I can use a trianglemesh .nxs, but scaling it is really... umm... annoying (Especially if u need this every ~5 sec.), and I actually just need a simple triangle (xD) for my editors pivot.


the first one (upper pivot is my currently used) however at these angles i can't select (raycast) the green xz square, because its hidden behind the xy and zy square.
The bottom image shows how I'd like it to be (3dsmax alike). Instead of xy zy squares, i'd have triangles, so clicking at the brown point would grab (raycast) the xz square.


BTW: is it only me having problems with raycast accurracy ? At some angles/distance of the camera it works perfect, at others there are some glitches like returning the neighbor object.

betajaen

16-10-2008 21:42:04

We have one, it's called ManualMesh in a near exact syntax you have there.

Just turn the mesh into a convexMesh and you can use it in ConvexShapes, or TriangleMesh/Triangle shape if you prefer.

http://nxogre.org/How_to_build_a_Convex_mesh_from_code

nargil

16-10-2008 22:04:29

great but...
1> Creating library r:\bin\Debug\wxWed2.lib and object r:\bin\Debug\wxWed2.exp
1>strzalki.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NxOgre::Resources::MeshParams::MeshFlags::fromNxU32(unsigned int)" (?fromNxU32@MeshFlags@MeshParams@Resources@NxOgre@@UAEXI@Z)
1>strzalki.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall NxOgre::Resources::MeshParams::MeshFlags::toNxU32(void)const " (?toNxU32@MeshFlags@MeshParams@Resources@NxOgre@@UBEIXZ)
1>strzalki.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NxOgre::Resources::MeshParams::MeshFlags::parse(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?parse@MeshFlags@MeshParams@Resources@NxOgre@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>r:\bin\Debug\wxWed2.exe : fatal error LNK1120: 3 unresolved externals

Any idea about this ?

betajaen

16-10-2008 22:05:46

Urgh..

Versions?

nargil

16-10-2008 22:09:33

1.0.22T2 I'll try T5 soon

nargil

16-10-2008 22:13:53

Same thing with T5. It's strange, because after adding NxOgreMeshParams.cpp into my project it works fine :P I just violate the license :P

It also seems to compile while compiling nxOgre.
1>Compiling...
1>NxOgreOgreMeshRenderable.cpp
1>NxOgreNxActorController.cpp
1>NxOgreNodeRenderable.cpp
1>NxOgreMeshRenderable.cpp
1>NxOgreMeshParams.cpp


It's more strange, than the strangelings which maybe will be discovered in CERN :P

betajaen

16-10-2008 22:32:17

Weird. I did check to see if those functions were filled out, after you posted.

nargil

16-10-2008 23:07:16

And all this is buggy:

NxOgre::Resources::ManualMesh* manual_mesh = new NxOgre::Resources::ManualMesh(NxOgre::Resources::MT_Triangle);
manual_mesh->begin();
manual_mesh->vertex(NxVec3(0,0,17)*skala);
manual_mesh->vertex(NxVec3(0,17,0)*skala);
manual_mesh->vertex(NxVec3(0,17,17)*skala);
NxOgre::Resources::Mesh* m = manual_mesh->end();
m->save("1.nxs");
kwadratZYactor = this->mScene->createActor("kwadratZYactor", new NxOgre::TriangleMesh(m), NxOgre::Pose(0,0,0), ap);


It crashes at m->save(). After commenting it out (i don't really need to save it - that was just for testing) it doesn't create the actor:
Actor Initialisation failed: returned NULL.
[NxOgre] Creation of Actor with the identifier 'kwadratZYactor' failed.

It also doesnt work if I change it to MT_Convex. At least it doesn't crash, but the result is far from good:

The selected object doesn't look like a triangle for me ;)

I think I'm gonna let it go and leave it as it was before. Maybe when NxOgre 2.0 is out ;)

betajaen

16-10-2008 23:14:03

There are no indicies given for that triangle.

TriangleMeshes; need indicies/vertices. Convexes: vertices and indicies(optional).

nargil

16-10-2008 23:23:50


manual_mesh->begin();
manual_mesh->vertex(NxVec3(0,0,17)*skala);
manual_mesh->vertex(NxVec3(0,17,0)*skala);
manual_mesh->vertex(NxVec3(0,17,17)*skala);

manual_mesh->index(0);
manual_mesh->index(1);
manual_mesh->index(2);


NxOgre::Resources::Mesh* m = manual_mesh->end();

doesn't change anything. Am I doing it wrong ? manual_mesh->isValid() returns true.

When saving the mesh at
ResourceSystem::getSingleton()->getCookingInterface()->NxCookTriangleMesh(desc, *rs);
in NxOgreMesh.cpp. From what I see *rs == 0. Should it be so ?

betajaen

17-10-2008 00:01:28

Your missing the resource identifier prefix:

m->save("file://test.nxs");

nargil

17-10-2008 00:35:27

ok now finally i can make create a static actor, with this mesh, but I can't create a kinematic one.

This code works fine:
NxOgre::ActorParams ap;
ap.setToDefault();
ap.mActorFlags.mDisableCollision = true;
ap.mBodyFlags.mIsKinematic = true;

NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://media//physX//strzalkaX.mesh.nxs", "strzalkaX");

strzalkaX = (NxOgre::Body*)this->mScene->createBody<NxOgre::Body>("strzalkaX.mesh", new NxOgre::TriangleMesh(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("strzalkaX")), NxOgre::Pose(Ogre::Quaternion(Ogre::Radian(Ogre::Math::PI/2*3), Ogre::Vector3::UNIT_Y),Ogre::Vector3(10,0,0)), ap);

[strzalkaX.mesh.nxs is made using floor]

and this does not:
NxOgre::ActorParams ap;
ap.setToDefault();
ap.mActorFlags.mDisableCollision = true;
ap.mBodyFlags.mIsKinematic = true;
//ap.Static(true); // uncomment this and it works, but that's not what I need

NxOgre::Resources::ManualMesh* manual_mesh = new NxOgre::Resources::ManualMesh(NxOgre::Resources::MT_Triangle);
manual_mesh->begin();
manual_mesh->vertex(NxVec3(0,0,17)*skala);
manual_mesh->vertex(NxVec3(0,17,0)*skala);
manual_mesh->vertex(NxVec3(0,17,17)*skala);

manual_mesh->triangle(0,1,2);

NxOgre::Resources::Mesh* m = manual_mesh->end();
NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("Pyramid", m);

strzalkaX = (NxOgre::Body*)this->mScene->createBody<NxOgre::Body>("strzalkaX.mesh", new NxOgre::TriangleMesh(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("Pyramid")), NxOgre::Pose(Ogre::Quaternion(Ogre::Radian(Ogre::Math::PI/2*3), Ogre::Vector3::UNIT_Y),Ogre::Vector3(10,0,0)), ap);

giving these errorsTriangleMesh::createShape(0F0DA338)
PhysX Error! NXE_DB_WARNING (f:\scmvista\experimental\PhysX_2.8.1_GPU\novodex\SD
Ks\Physics\src\Actor.cpp:1145)
createActor: Dynamic triangle mesh instantiated!
PhysX Error! NXE_INVALID_PARAMETER (f:\scmvista\experimental\PhysX_2.8.1_GPU\nov
odex\SDKs\Physics\src\Actor.cpp:419)
Actor::loadFromDescInternal: Can't compute mass from shapes: must have at least
one non-trigger shape!
PhysX Error! NXE_INVALID_PARAMETER (f:\scmvista\experimental\PhysX_2.8.1_GPU\nov
odex\SDKs\Physics\src\NpScene.cpp:892)
Actor Initialisation failed: returned NULL.
[NxOgre] Creation of Actor with the identifier 'strzalkaX.mesh' failed.
Mesh: Loading strzalkaX.mesh.


Could you please explain it to me ?

betajaen

17-10-2008 09:09:05

It's telling you in the error there, you can't use triangle meshes in anything but static actors.

nargil

17-10-2008 09:15:41

But when using the first code (with precooked strzalkaX.mesh.nxs) as a kinematic trianglemesh it works fine.

betajaen

17-10-2008 09:17:10

It shouldn't have. Seriously; Make it static or use a convex mesh.

nargil

17-10-2008 09:26:47

Ok thank you for all the help. I finally got the convex working, so I post here the solution. The problem was that for:
manual_mesh->vertex(NxVec3(0,0,17)*skala);
manual_mesh->vertex(NxVec3(0,17,0)*skala);
manual_mesh->vertex(NxVec3(0,17,17)*skala);

it created a box as convex. After adding some dimmension it creates a triangle i desire
manual_mesh->vertex(NxVec3(0,0,17)*skala);
manual_mesh->vertex(NxVec3(0,17,0)*skala);
manual_mesh->vertex(NxVec3(0,17,17)*skala);
manual_mesh->vertex(NxVec3(1,17,17)*skala);