Jump to content

changing gravity (mass) in game script


acd009
 Share

Recommended Posts

I have have been trying make a object in my game switch its mass to 0 when i hit a button.

I am very new to leadwerks and dont know much about scripting but the very basics.

I found a script for doing this on one of aggor/ricks forums and for some reason it redirects me to a page that says sorry can not find that file. Did he remove the file or is there just something wrong with the page?

Link to comment
Share on other sites

Not really sure what you are asking in the post above. This is how I would do it:

 

You have a button with a buttonscript.

You have a rock/box with a ActivateMassScript. The rock/box has a mass higher than 0 and is of collision type prop.

 

 

The button script has a Flowgraph output called "button pressed".

The massScript has an input function called "ActivateMass" (or a name that you find usefull)

 

Inside the flowgraph editor you hook the output to the input.

 

The massScript:

  • The Start function has saves the current mass to a temp variable and sets the current mass to 0.
  • The ActivateMass function sets the mass back to original value, which is stored in the temp value.
  • (instead of swapping the mass value, we can also set different collision types. it realy depends on what you find most useful.)

Link to comment
Share on other sites

In my game I have logs (are collected from trees) and I have the same script that allows you to pick up barrels in the tutorial maps attached that makes them able to be picked up and I need that script so you can build shelters.

How could I make the logs have two scripts. I tried using pivots but it doesnt work.

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...