Lua error, accessing _btRigidBody?

View previous topic View next topic Go down

Lua error, accessing _btRigidBody?

Post  yarri on 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

View user profile

Back to top Go down

Re: Lua error, accessing _btRigidBody?

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

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lua error, accessing _btRigidBody?

Post  yarri on 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

View user profile

Back to top Go down

Re: Lua error, accessing _btRigidBody?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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