Jump to content

Chain physics


KTyJLXy
 Share

Recommended Posts

Sup guys, long time no see.

I've just wanted to know, if there anyway to get chain physics for the model? For swinging things around on the end of that chain, you know, all that stuff. I can't think of any good method to do this.

Any tips? smile.png

Link to comment
Share on other sites

So, i'm trying to make Joint:Ball script and so far i have joint script:

 

 



Script.parent = nil --entity
Script.child = nil --entity
Script.position = self.model:GetPosition --Vec3

function Script:Start()
App:Joint(self.position, self.child, self.parent)
end

 

And app function for creating joints:

 

 

 

function App:Joint(parent_position, child, parent)
joint = Joint:Ball(self.parent_position, self.child, self.parent)
end

 

All it does now - just crashes the game.

What i did wrong? mellow.png

Link to comment
Share on other sites

based on the code you posted Im guessing that 'Script.position' is nil - it refers to "self.model" which isn't set in the code snippet you posted

 

also

 

function App:Joint(parent_position, child, parent)

joint = Joint:Ball(self.parent_position, self.child, self.parent)

end

 

 

Assuming that lua is like most other OOPs "self" is a pointer to the object instance meaning that self.child != child meaning that you call Join:Ball with (nil,nil,nil)

 

that seems likely to cause a crash even if self.model is defined :)

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...