FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Lua error, accessing _btRigidBody?

2 posters

Go down

Lua error, accessing _btRigidBody? Empty Lua error, accessing _btRigidBody?

Post  yarri Tue May 26, 2009 1:16 am

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:
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

Back to top Go down

Lua error, accessing _btRigidBody? Empty Re: Lua error, accessing _btRigidBody?

Post  sio2interactive Tue May 26, 2009 1:40 am

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.
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Lua error, accessing _btRigidBody? Empty Re: Lua error, accessing _btRigidBody?

Post  yarri Tue May 26, 2009 11:08 am

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

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

Lua error, accessing _btRigidBody? Empty Re: Lua error, accessing _btRigidBody?

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum