playcanvas / playcanvas/engine
Raycast returns always null on first frame [AMMO]
Open
Nobody has claimed this yet.
area: physics
- Dominant language
- JavaScript
- Stars
- 16.8k
- Forks
- 2k
- Avg merge
- 4h 32m
- Merged PRs (30d)
- 222
Description
Reproduced
var Main = pc.createScript('main');
// initialize code called once per entity
Main.prototype.initialize = function() {
this._box = this.app.assets.find("Box", "template").resource.instantiate();
};
Main.prototype.postInitialize = function(){
this.box1 = this._box.clone();
this.app.root.addChild(this.box1);
this.box1.setPosition(0, 0.5, 0);
this.box2 = this._box.clone();
this.app.root.addChild(this.box2);
this.box2.setPosition(3, 0.5, 0);
const from = this.box1.getPosition();
const to = this.box2.getPosition();
console.log(this.app.systems.rigidbody.raycastFirst(from, to));
};
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the provided Main script and its postInitialize entry point. Start by tracing this.app.systems.rigidbody.raycastFirst(from, to) and the first-frame initialization sequence. Done means the initial raycast returns the expected hit rather than null.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100