Need to move Triangle Mesh object 8-)

s0lidnuts

31-07-2008 01:42:00

Yep :roll:
I'm using NxOgre/PhysX for Raycasting; the raycasting is working perfectly with the fixes for '21, but I'll need to move the object (I don't need it to be dynamic, just need to move it). I could do it with setGlobalPosition but that's illlegal for PhysX as I can see.
Is there any solution for my problem? Currently I'm thinking on removing the physics from the object, making the necessary movements (translate, rotate, etc) and then adding the physics again. I'd be glad if there was a best option, this one doesn't seem the best one =P

betajaen

31-07-2008 09:13:20

If you move the static actor, a number of things may happen:

1. Some objects that are in the way of the new position which are sleeping may be stuck inside the triangle mesh - as they are sleeping they won't notice until they are woken up again and disaster strikes!

2. NxOgre probably won't notice that the Actor has been moved thus won't move the SceneNode for you. You can manually fire up the render function after you've moved it though.

3. PhysX will report it as a warning and dump it to the log. If your planning to move the actor in slow increments rather than teleporting, the log is going to be filled up quickly and slow down your application with disk access.


How about using a dynamic actor with the triangle mesh attached but with the kinematic flag set on? It may work.

s0lidnuts

31-07-2008 10:53:25

lol
"kinematic: yes" on body creation works perfectly
guess I should know it already

Thanks betajaen.

betajaen

31-07-2008 11:19:39

Except it's now this in '22:

body-flags: +kinematic

But I'm glad it works, else we would have to come up with a very horrible and difficult solution. :)

s0lidnuts

31-07-2008 20:08:14

Yes it would =P
@off, not to create another thread: I'm thinking if the program (a map editor) will become slow as I use many triangle meshes; Also, do you know aproximately when '22 will come out (just thinking on code changes that will be needed, and I know this is not a nice question =P)

Anyway, thanks =)

betajaen

31-07-2008 20:57:16

I don't see why not; Many PhysX applications/games have editors (I presume all of those commercial games have in house editors) that use them. Just don't insane with the amount of them, and substitute more simpler shapes when you can.

As for '22 not for a few weeks. I want to start/finish cloth and have a simple character system working before I release it. Not only that finish of Cake 4.0 and Flour 0.2. It's a lot of code. I was hoping to release it around now-ish, but it doesn't seem so.

s0lidnuts

01-08-2008 00:25:57

Awww.. come on

PhysX Error! NXE_DB_WARNING (f:\scmvista\experimental\PhysX_2.8.1.1\novodex\SDKs
\Physics\src\Actor.cpp:1145)
createActor: Dynamic triangle mesh instantiated!

any way to vanish this one off ?

And how could I know if the user user mesh is simple enough so that I can use another shape ? (I'll be using Flour to create the triangle meshes)
I plan on creating a Scythe parser to help the user to create the scene. Is there any serialization working with NxOgre right now that I could export along with the project files ?
@bonus question: to rotate objects, moveGlobalOrientation? =P

Thanks.

betajaen

01-08-2008 08:54:56

What about a convex? Or a compound of convexes? I don't know what the mesh looks like to give an opinion.

s0lidnuts

01-08-2008 10:45:17

Well it can be any mesh, as for now I'm testing with the robot. Also, as I'm using PhysX for Raycasting, the phys mesh needs to be exactly the same as the 3d mesh.
And what about the other questions ? And is it possible to create compound shapes by analyzing the mesh, without user intervention ?

Thanks.

betajaen

01-08-2008 10:56:11

I've seen Scythe do that, but I don't know if it will save them as nxs meshes or not.

As for your other questions: Serialisation in '22 and there has been some work on a Scythe importer but no word about that yet.

s0lidnuts

01-08-2008 19:20:15

Ok, except for the warning PhysX gives me when creating the object, moving is fine.
Now, how can I scale the object?
And what about rotation, is it made through setGlobalOrientation?

Thanks

betajaen

01-08-2008 19:54:08

Rotation; yep. But scaling would require the mesh to be re-cooked, loaded and added to the shape.

s0lidnuts

01-08-2008 20:24:52

As this is going to be an editor, scaling will be done interactively, which means scaling while mouse is moving. Any suggestions ?
Also, all I can find about rotation is:
- setting rotation/scaling while loading the object.
- rotating to a determinated place

I just want something like rotateXDegrees(Axis) and getRotationDegree(Axis).

Thanks.

betajaen

01-08-2008 20:56:38

You could scale the Ogre::Mesh whilst scaling in the editor, and re-cook/convert the PhysX mesh after the scale is finalised.

As for rotation; the Ogre::Quaternion is very flexiable if you want to rotate so many degrees on an axis; such a feature is in one of the constructors.

mcaden

01-08-2008 21:07:24

Why would an editor need physics to actually be running?

Are you running simulations?

s0lidnuts

01-08-2008 21:13:57

Rotation is working perfectly.
Yes I am, I don't know why right now, just remember I tought on it and I found a reason.. anyway if I don't remember, what would be the benefits of stopping the simulation :roll: (just fell like I'm doing a really dumb question here).
And how should I recook the meshes ? Detaching the current mesh, recooking and adding it again ? If so, how ?

Thanks

s0lidnuts

02-08-2008 03:19:00

Also, how can I make move/setGlobalPosition work like translate(), so that I can set TS_LOCAL/WORLD and stuf..