Product Chat / Where are phycis commands ?

Author
Message
Mouaa
User Banned
Posted: 29th Dec 2016 15:58 Edited at: 29th Dec 2016 15:58
I read Lua functions docs , but i could not find common Physics Api to make pjysics gameplay and puzzles
-AddForce
-SetVelocity
-AddTorque
-SetAngularVelocity
-SetCollisionLayer (collision layers like Unity to define what physics objects layer can collide or not with another Physics layer)
-SetCollision on/off
-OnEnter collision , OnCollisionLeave, OnCollisionStay
-SetCollisionShape, RemoveCollisionShape
-SetGravityValue

Did i missed something ?
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 29th Dec 2016 16:02
Go to your scriptbank, find global.lua and open it up. Under the heading "-- Common Action Functions (called by LUA)" is a list of all the lua commands we can use, if it's not on there, then we don't have it.

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Mouaa
User Banned
Posted: 29th Dec 2016 16:03 Edited at: 29th Dec 2016 16:08
Thank you, i have checked and they don't exist.
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 29th Dec 2016 16:16 Edited at: 29th Dec 2016 16:19
Collision ones are in the globals.lua:

function CollisionOn(e)
SendMessageI("collisionon",e);
end
function CollisionOff(e)
SendMessageI("collisionoff",e);
end

only gravity related commands are:

function GravityOff(e)
SendMessageI("setnogravity",e,1);
end
function GravityOn(e)
SendMessageI("setnogravity",e,0);
end

If commands do not exist in GLOBALS.LUA they don't exist at all. However, if you're clever enough you can create your own functions in LUA
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: SegAutoWelder, Entity+Weapon Welder
Mouaa
User Banned
Posted: 29th Dec 2016 16:29
However, if you're clever enough you can create your own functions in LUA
Yes to some extend only and with more coding lol
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Dec 2016 20:20
Actually this was in my first email to Lee a year ago, asking how the friction and gravity settings worked with active entities and basically the answer is that they don't. The Bullet engine is in there but currently is not used properly and there is no access to it from Lua.

As far as I can see Lee has implemented a simple passive interface, it just sets up the collision meshes, sets gravity and let Bullet take over.

You can certainly create Lua scripts to move stuff around but the lack of physics is a real limiting factor in what you can accomplish.
Been there, done that, got all the T-Shirts!
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Dec 2016 20:53
As far as I know there is one command to apply a force to a limb, that's it beyond enabling and disabling it. I've never played with it as yet, you would hope it would work with any object, but I have a feeling it will be character based only. I have also complained that considering we have a physics engine, there is very little you can actually do with it.


SPECS: Q6600 CPU. Nvidia 660GTX. 8 Gig Memory. Win 7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Dec 2016 20:57
if i remember correctly from when i played with it the one you're referring to only works for objects with ragdoll set up and it also requires the object to be dead (to trigger the ragdoll state in the first place).
i did play around with it as a form of throwing objects but it still feels weird, the collision is kinda slidey
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-07-03 04:53:53
Your offset time is: 2024-07-03 04:53:53