This is where active bugs can be seen and where to post a new bug.

Lua SetGravity

Lua SetGravity

Postby SpiderMack » 26 Sep 2017, 21:42

I got anobject with physics and set as dynamic.

In micro script i cancel gravity with null values.

Code: Select all

function onInit(objID)
   obj    = objID;
   speed    = sky.getVar("speed");
   bodyID    = physics.getBodyID(obj);
   physics.setBodyGravity(bodyID,0,0,0);
end



But the object keeps gravity and falls on the ground.
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Lua SetGravity

Postby SolarPortal » 28 Sep 2017, 10:07

ill have to try this, but i think this could be a remnant function from when we were using bullet for physics.
In PhysX, i do not believe each body can have its own gravity unless programmed from scratch using a kinematic body.
For physx, you can set the scene gravity by using

physics.setSceneGravity()
http://www.chi-ad.com/Skyline/API/Lua/html/class_physics.html#a03ca28620bf165727bdd0d977ea89f8d

Thanks for the report :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Lua SetGravity

Postby SpiderMack » 28 Sep 2017, 13:26

It's very common in game development to disable gravity on objects such as missile,space ships or for special effects or about gameplay.

Perhaps this one ?

https://stackoverflow.com/questions/3015017/bullet-physics-engine-how-to-freeze-an-object

void btRigidBody::setGravity(const btVector3 &acceleration)
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Lua SetGravity

Postby SolarPortal » 28 Sep 2017, 14:06

we aren't using bullet physics, instead we are using physX. so that command doesn't work.
Will take a look in the physx api to see if we have the command :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Lua SetGravity

Postby SpiderMack » 28 Sep 2017, 14:29

SolarPortal wrote:we aren't using bullet physics, instead we are using physX. so that command doesn't work.
Will take a look in the physx api to see if we have the command :)



I done it for you

http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/RigidBodyDynamics.html

Certain special effects can require that some dynamic actors are not influenced by gravity. To specify this set the flag:

Code: Select all
PxActor::setActorFlag(PxActorFlag::eDISABLE_GRAVITY, true);
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Lua SetGravity

Postby SolarPortal » 28 Sep 2017, 14:35

unfortunately, that is physx 3.x+, which we do have planned to upgrade, but it does take time to integrate.
We are using PhysXx v2.8.6.4

PhysX 3.0 improved a lot of stuff and added a lot of the missing components, but when we integrated physx, physx 3 did not exist. :P

thanks for looking though :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Lua SetGravity

Postby SolarPortal » 28 Sep 2017, 14:48

no, that flag doesn't exist on this api version.

However, an excerpt from the link you provided does say:

An alternative to PxActorFlag::eDISABLE_GRAVITY is to use a zero gravity vector for the whole scene, then apply your own gravity force to rigid bodies, each frame. This can be used to create radial gravity fields, as demonstrated in SampleCustomGravity.


This is located just under the set gravity section and talks about performance from disabling gravity and having to reawaken actors.
Quite a handy bit of information :) and that's from nvidia themselves.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Lua SetGravity

Postby SpiderMack » 28 Sep 2017, 19:03

It would be too much work to disable whole scene gravity and enable gravity per object, instead of letting people disable and disable gravity per object as they need.

hysX 3.0 improved a lot of stuff and added a lot of the missing components


I hope this will become a priority and Skyline will move to Physix 3 quickly before Steam release whenever it is planned :D

Physics are the most essential part about 3D gameplay.
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Lua SetGravity

Postby SolarPortal » 28 Sep 2017, 19:21

well, thats just what comes from nvidia themselves who know how to make it work its best.

We will be updating to physx 3.0 after the main release as we dont think its that important an upgrade just to disable gravity on a few actors lol :P

What we have in engine is what we will be releasing with, then we can start improving and taking skyline to the next stage afterwards. For our own sanity, we need to conclude this rendering upgrade and get a main public version back out to everyone and leave the beta tag behind.

Physics are the most essential part about 3D gameplay.

They are, but we have managed to do most physics things already if not for a little extra work. Also adding physx 3.0 doesnt mean we intantly have constraints and the rest, as we can already add them.. but its time that is missing to do these features :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Lua SetGravity

Postby SpiderMack » 28 Sep 2017, 21:47

We will be updating to physx 3.0 after the main release as we dont think its that important an upgrade just to disable gravity on a few actors lol :P

Lot of games uses gravity disable , for space ships, flying vehicles, missiles or physic bullets or projectiles that does not use gravity.
Indeed i doubt someone will publish a game just after Steam release and needs that features right away :lol:

They are, but we have managed to do most physics things already if not for a little extra work. Also adding physx 3.0 doesnt mean we intantly have constraints and the rest, as we can already add them.. but its time that is missing to do these features :)

It's a balance to find, Physix 3 i think is about performance and some small features that can be added.
It will be good to have Skyline up to date about it's middleware :D
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Lua SetGravity

Postby SolarPortal » 29 Sep 2017, 10:04

It's a balance to find, Physix 3 i think is about performance and some small features that can be added.
It will be good to have Skyline up to date about it's middleware :D

Most certainly and we tend to keep everything up to date as best we can, but at this stage as you say, no one is going to publish straight away a game that doesnt use gravity. So we have to weight up the cost of development and integration over getting this version of skyline complete lol :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Lua SetGravity

Postby StarFire » 29 Sep 2017, 11:41

I notice you mention physics for space ships, bullets etc, this is done using kinematic bodies that do not respond to forces such as gravity, with these you have to program the forces yourself. This is a far more efficient route and used by many top games as you have full control over the body and is better for performance as its not calculated in the main physics world, yet still can interact. ;)
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Lua SetGravity

Postby SpiderMack » 29 Sep 2017, 13:11

StarFire wrote:I notice you mention physics for space ships, bullets etc, this is done using kinematic bodies that do not respond to forces such as gravity, with these you have to program the forces yourself. This is a far more efficient route and used by many top games as you have full control over the body and is better for performance as its not calculated in the main physics world, yet still can interact. ;)


Thank you for the tip, is there some kinematic Lua example ?


Also i seen some example in Skyline, if you look at the fireball script example, it uses a simple character controller with setGravity command :lol:
User avatar
SpiderMack
Skyline Expert
 
Posts: 441
Joined: 02 Dec 2016, 09:15
Skill: Concept artist
Skill: 3D Modeller
Skill: Level Designer
Skill: Scripter

Re: Lua SetGravity

Postby StarFire » 29 Sep 2017, 13:16

it uses a simple character controller with setGravity command

Yes the character controller is one type of kinemetic body ;)
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer


Return to Active / New Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron