Coder Social home page Coder Social logo

Comments (6)

ssatguru avatar ssatguru commented on August 11, 2024

@warrenchopin try setting _freeFall to true instead of false. Let me know if that works

from babylonjs-charactercontroller.

warrenchopin avatar warrenchopin commented on August 11, 2024

The above error was raised when _inFreeFall= true. I edited the posting correctly.

I tested both _inFreeFall= true and false cases again for sure. The error was raised only when _inFreeFall= true

I thought about three scenarioes to solve this problem.

  1. a new command freeFall()
  2. a new command moveToPosition(pos, freeFall)
  3. a new command moveDiff(vDiff)

The best solution for me is 3. moveDiff(). It is a general function that can be used in many different situations. The problem happened after I overwrote avatar.mesh.position at collision. Overwriting position is pretty aggressive way possibly disrupting CharacterController. moveDiff() will give a way to avoid overwriting mesh.position. Is there a similar function available now?

Thanks again.

from babylonjs-charactercontroller.

ssatguru avatar ssatguru commented on August 11, 2024

You are right in that we do need a function for fall.
Just like we can do jump programmatically , we should be able to do fall too.
This will be usefull for use cases like yours, moving platforms etc.
Let me work on this.

In the meantime try setting CharacterController._grounded to false after collision and let me know if that works.

from babylonjs-charactercontroller.

warrenchopin avatar warrenchopin commented on August 11, 2024

It worked when I set the two variables together.

cc._inFreeFall= true 
cc._grounded= false

The collided avatar free falls naturally now: The problem solved. Thanks you so much for your help.

from babylonjs-charactercontroller.

ssatguru avatar ssatguru commented on August 11, 2024

Nice.
I just published a new version (0.4.4) with a cc.fall() function to force a fall.
This should also play a fall animation while falling.

from babylonjs-charactercontroller.

warrenchopin avatar warrenchopin commented on August 11, 2024

@ssatguru: The error was raised later again. I set only cc._grounded=false at this time, and the error disappeared again:

cc._grounded= false

I am not sure whether CharacterController is unstable, or my program is unstable in this case. I will report here if something is wrong again.

Thanks again.

from babylonjs-charactercontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.