Andy Gilbert Posted November 30, 2009 Share Posted November 30, 2009 Hi, ok in the editor i have my model and in the lua script attatched to the model i have create a spawn function where i create a physics body and give it a mass and parent it to my model, but then with physics on its simply sinks threw the terrain? How do i make it collide with it? Ive tried giving the body a collision type 1, but doesnt seem to do anything? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 You don't need to create a physics body with LUA, just make a phy file with phygen for it. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 You don't need to create a physics body with LUA, just make a phy file with phygen for it. But... if my model is a complex shape the physics seems to be just in the middle of the model and parts of my model go threw the terrain still?? So i though about using a main body and then attatching more bodies to the main, that way i can also add forces on different bodies but on the same model, just in different areas of the model. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 I think you have multiple physics bodies, if you don't create one with phygen, but create one by code on top of the fixed physics body which Editor creates if you didn't create your own physics body with phygen. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 Ok, so how do i retrieve the body that is created by either phygen in lua to add another one? Edit: thiss is what i have... A model that has a phygen file which has a mass of 1.. if i put that in the editor as it is, it slowly falls to the terrain and does a small bounce and stop (all good). If i then enter this into the lua script for the model: dofile("Scripts/base.lua") function Spawn(model) local entity=base_Spawn(model) body1=CreateBodyBox(0,0,0) EntityParent(model,body1) body1:SetMass(10) return entity end It then falls threw the terrain, if i remove the SetMass line it works ok. thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 I think you shouldn't do that, but if you do, you need at least to set EntityType(body1,1). Although I think that command does not exist in LUA. You can't also use physics bodies with smaller than 0.1 dimensions, so your dimension of 0,0,0 will definitely not work. I use only physics shapes created with phygen, it makes life much easier as then I can control their mass and other settings from the properties dialog. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 I think you shouldn't do that, but if you do, you need at least to set EntityType(body1,1). Although I think that command does not exist in LUA. I use only physics shapes created with phygen, it makes life much easier as then I can control their mass and other settings from the properties dialog. So.. i cannot create bodyboxes in lua? Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 You probably can, but I think you need then to remove the Editor created static physics body first with LUA code (not from disk, but from the mesh). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 Ok, and how would i go about doing that? Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 Something like FreeEntity(model), and then body1=CreateBodyBox() and EntityParent(mesh,body1). Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 ok well doing this : dofile("Scripts/base.lua") function Spawn(model) local entity=base_Spawn(model) FreeEntity(model) body1=CreateBodyBox(0,0,0) EntityParent(model,body1) body1:SetMass(10) return entity end Crashes the editor... i think im just going to forget about things for a week or so untill some sort of docs are done or things are sorted as its clearly very unsupported at the moment and obviosuly still has issues... Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Josh Posted November 30, 2009 Share Posted November 30, 2009 You should never parent one body to another. Why are you trying to do this? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 Sorry, i didnt mean it like that ,what i mean was i would fix bodies together using fixed pivots. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 And if you just deleted model, you can't use it anymore. I thought you wanted to parent the body1 to the mesh, somehow like: EntityParent(entity,body1) Although I don't know right now how to get the mesh from the entity Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.