Lua error, accessing _btRigidBody?
2 posters
Lua error, accessing _btRigidBody?
Hi,
I'm experimenting with using Lua to control physics objects, but getting a runtime error. Attaching a lua script to an dynamic body, I'm trying to apply an impulse with the following code:
But I get the following runtime error:
I'm sure this is a case where "setLinearVelocity()" isn't wrapped in Lua, but can you suggest what I would need to change to access physics objects? Do I need to update the sio2.module to add all the Bullet headers or is there an easier way?
Thanks,
--yarri
I'm experimenting with using Lua to control physics objects, but getting a runtime error. Attaching a lua script to an dynamic body, I'm trying to apply an impulse with the following code:
- Code:
Bot.vel = SIO2.sio2Vec3Init();
Bot.vel.x = 2.0;
Bot.vel.y = 2.0;
Bot.vel.z = 1.5;
Bot.obj._btRigidBody.setLinearVelocity( Bot.vel );
But I get the following runtime error:
[ ERROR ] 1:[string "-- This script is just an example and sugge..."]:58: attempt to index field '_btRigidBody' (a userdata value).
I'm sure this is a case where "setLinearVelocity()" isn't wrapped in Lua, but can you suggest what I would need to change to access physics objects? Do I need to update the sio2.module to add all the Bullet headers or is there an easier way?
Thanks,
--yarri
yarri- Posts : 81
Join date : 2009-04-10
Re: Lua error, accessing _btRigidBody?
I think wrapping ALL bullet API is a bit useless... I would write some helper function to do what I want and get back the result from LUA. However... I do not believe that Bullet should be included in LUA only the API that access internal Bullet functions... just like SIO2.
Re: Lua error, accessing _btRigidBody?
Make sense... I'm working on steering in Lua, and so will just pass the vector back to SIO2 via the userdata pointer:
Bot.obj.userdata = Bot.vel;
And then update the physics in the SIO2 render thread.
--yarri
Bot.obj.userdata = Bot.vel;
And then update the physics in the SIO2 render thread.
--yarri
yarri- Posts : 81
Join date : 2009-04-10
Similar topics
» Tutorial 16 error
» Error when using sound files
» v1.2 Tutorial 08 error
» btPoolAllocator error
» CodeSign error
» Error when using sound files
» v1.2 Tutorial 08 error
» btPoolAllocator error
» CodeSign error
Permissions in this forum:
You cannot reply to topics in this forum