Jump to content

How to manipulate Ninja physics body properties such as drag, gravity, etc.?


ChubbRck
 Share

Recommended Posts

Hi all,

 

Apologies for what is sure to be a noob question, but I'm trying to switch from Arcade physics to Ninja physics and finding some things that I expected to work properly are not - 

 

For instance, I enable a simple AABB physics object by 

basket = game.add.sprite(game.world.centerX, game.world.height - 100, 'basketimage');game.physics.ninja.enableAABB(basket);

..which seems to give the object physics properties and it immediately falls offscreen due to gravity. I try and adjust properties such as

basket.body.drag.x = 50;basket.body.maxVelocity.x = 250;basket.body.gravity.y = 0;

... to no avail. I get error messages such as "Cannot set property 'y' of undefined

 

Does anyone know what I'm doing wrong? Am I adding/enabling a physics body incorrectly? Thanks for your assistance.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...