Rekindled Phoenix Posted July 6, 2011 Share Posted July 6, 2011 I'm looking at the Oil drum object, and even the cage lights which are initialized with gravity in the Sandbox editor, and can't replicate the same results! What is wrong with this script? require("scripts/class") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) model:SetKey("mass",1) model:SetKey("collision",COLLISION_PROP) -- OR function object:Init() self.model:SetKey("mass",1) self.model:SetKey("collision",COLLISION_PROP) end object:Init() end Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 6, 2011 Share Posted July 6, 2011 there's nothing wrong with the script that I can see concerning SetBodyGravityMode() and the gravity option is checked for me, which it should be since a body's gravity is enabled by default. So even just a script that contains just the first two lines should make the gravity option be checked in the properties. i would try restarting the editor and placing another instance of the model into the scene. The only problems i see in that script is the fact you are using the COLLISION_PROP variable when its not being defined and a key that doesn't exist in the class script. you need to add this line if you are going to use that variable: require("scripts/constants/collision_const") or just set the variable to a 1. and then change the key to match what is being used in the class script: model:SetKey("collisiontype",1) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted July 6, 2011 Author Share Posted July 6, 2011 Unfortunately, that doesn't work. (When dragged into the editor, properties mass and gravity are set appropriately, but the object never moves / falls) Look at the script for the fixture_hanginglight object. There is no reference to any include file, though they are used and work correctly. Same goes for the oil drum, which doesn't specify keys at all, yet is initialized with gravity. I'm completely confused... Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 6, 2011 Share Posted July 6, 2011 You do not need to include any other files if you just want the gravity property key checked. The required file i mentioned above is for actually setting the collision type property correctly. If you are referring to it actually responding to physics and falling down, then you need a PHY body created from phygen. I cannot replicate the issue. It works every time correctly even with just the first two lines. You dont happen to have an INI file for that model with the gravity set to 0 by chance? You could also try to set the variable yourself: object.model:SetKey("gravity",1) Other than that, the only thing i would suggest assuming you haven't modified the class.script is to download a clean copy of the SDK. **EDIT - you have edited your post since i commented. Dynamic objects must have their PHY bodies created with phygen. The PHy body created by the editor is for static models ONLY. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted July 6, 2011 Author Share Posted July 6, 2011 Thanks Macklebee, I'm going to try: - new PHY (not generated by Sandbox) - new INI (non-existent) Then if that doesn't work I'll have to update my SDK files. I'll post later when all that is done. Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 6, 2011 Share Posted July 6, 2011 Thanks Macklebee, I'm going to try: - new PHY (not generated by Sandbox) - new INI (non-existent) Then if that doesn't work I'll have to update my SDK files. I'll post later when all that is done. Just creating a new PHY body with phygen should resolve your issue. I just mentioned the INI file because it seemed like you were implying that the gravity property was not being checked in the dialog and it made no sense that it would not be. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted July 6, 2011 Author Share Posted July 6, 2011 Just creating a new PHY body with phygen should resolve your issue. It did! That solved it! Apparently the method that the Sandbox Editor uses creates PHY files that, for some reason, aren't affected by gravity. Should this be reported as a bug? Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 6, 2011 Share Posted July 6, 2011 It did! That solved it! Apparently the method that the Sandbox Editor uses creates PHY files that, for some reason, aren't affected by gravity. Should this be reported as a bug? No. Like I said above, the PHY body created by the Editor is ONLY for STATIC models. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel 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.