GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — When creating new Extended3D Objects I get a weird physics behavior · Issue #242 · enable3d/enable3d

When creating new Extended3D Objects I get a weird physics behavior #242

New issue
Copy link
New issue
Copy link
Closed
Closed
When creating new Extended3D Objects I get a weird physics behavior#242
Copy link
Labels
Stale

Description

@finkton1
finkton1
opened on Jan 28, 2022
Issue body actions

When I create new objects during runtime, it seems like every 3d object will share the same rotation in simulation.

Why do they share the same physics body? Should they not be separate bodies for each new instance of Extended3D object?

I am using "this.physics.add.cylinder" in headless mode

Any help is appreciated - been stuck on it for days.

Example screenshot : https://ibb.co/GcBNCMv

As you can see all objects are rotating in real time with same rotation.... strange.

edit: Looks like I was using object.body.rotation and sending that to the client. It should be object.rotation instead for local rotation.
What is the difference between the two?

Activity

  1. yandeu commented on Jan 28, 2022

    @yandeu
    yandeu
    on Jan 28, 2022
    Member
    More actions

    Do you get the same error in Non-Headless mode?

    Can you try to add a unique name to each object?
    this.physics.add.cylinder({name:'unique'})

  2. finkton1 commented on Jan 28, 2022

    @finkton1
    finkton1
    on Jan 28, 2022
    Author
    More actions

    Do you get the same error in Non-Headless mode?

    Can you try to add a unique name to each object? this.physics.add.cylinder({name:'unique'})

    That does not seem to make a difference.

    This same issue applies to body.position as well.

    And no it does not seem to be an issue in non-headless mode.

  3. yandeu commented on Jan 28, 2022

    @yandeu
    yandeu
    on Jan 28, 2022
    Member
    More actions

    Are you calling transform and refresh on the body?

      /** You have to call transform() before you can get or set the body's position or rotation. (for headless mode only) */
      public transform() {
        const t = this.physics.worldTransform
        this.ammo.getMotionState().getWorldTransform(t)
      }
    
      /** You have to call refresh() after you set the position or rotation of the body. (for headless mode only) */
      public refresh() {
        const t = this.physics.worldTransform
        this.ammo.getMotionState().setWorldTransform(t)
      }
  4. finkton1 commented on Jan 28, 2022

    @finkton1
    finkton1
    on Jan 28, 2022
    Author
    More actions

    Are you calling transform and refresh on the body?

      /** You have to call transform() before you can get or set the body's position or rotation. (for headless mode only) */
      public transform() {
        const t = this.physics.worldTransform
        this.ammo.getMotionState().getWorldTransform(t)
      }
    
      /** You have to call refresh() after you set the position or rotation of the body. (for headless mode only) */
      public refresh() {
        const t = this.physics.worldTransform
        this.ammo.getMotionState().setWorldTransform(t)
      }

    Ahh - that was it, I was missing that.

    I just added it to the server update loop, right before I send all the rotations and positions to the client.

    Thanks for the help!!!

  5. yandeu commented on Jan 29, 2022

    @yandeu
    yandeu
    on Jan 29, 2022
    Member
    More actions

    Glad it works!

    I have just updated the docs:
    enable3d/enable3d.github.io@6285739

  6. github-actions commented on Nov 25, 2022

    @github-actions
    github-actionsBot
    on Nov 25, 2022
    More actions

    This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 10 days.

  7. github-actions
    added
    Stale
    on Nov 25, 2022
  8. github-actions commented on Dec 5, 2022

    @github-actions
    github-actionsBot
    on Dec 5, 2022
    More actions

    This issue was closed because it has been stalled for 10 days with no activity.

  9. github-actions
    closed this as completedon Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.