First of all: guys of PLAYCANVAS you made excellent work! I have to say I know Unity and it was quite easy to get familiar with PLAYCANVAS. Really excellent and thank you for your hard work we can profit from now (hopefully you too by paying accounts).
Im working on a simple game project, nothing special, just to test out PLAYCANVAS…
Bug or not updated documentation(?)
Today I found a difference between documentation and demo about basis mouse input at
http://developer.playcanvas.com/tutorials/beginner/mouse-input/
In this page I found a sample code and within that the sample code “onMouseMove”:
onMouseMove: function (event) {
// Get the current camera Entity
var cameraEntity = context.systems.camera.current
// Use the camera component's screenToWorld function to convert the
// position of the mouse into a position in 3D space
var depth = 10;
cameraEntity.camera.screenToWorld(event.x, event.y, depth, this.pos);
// Finally update the cube's world-space position
this.entity.setPosition(this.pos);
}
I got an error using that code fragment at line 30: unknown object… (or similar)
The error line: var cameraEntity = context.systems.camera.current
Checking the demo code (tutorial of Mouse Input) on the same side this line differs: var cameraEntity = context.root.findByName(‘Camera’);
With that line my code worked fine. Im sure there is a solution using “current”, just dunno how.
Working with Force
Today I played around with a force on an entity. I thought I made all right: rigidbody attached, set to dynamic….
The force just wasn’t visible on the falling object. Then, by lucky chance, I found a hint in this forum:
Create the force inside the update function.
Doing so the force related is being affected by the force! This confused my. I expected to attach a force only once and thats it. Why do I have to permanenlty refresh the force inside the update function? If so I still could deactivate the force with the deactivate method when not needed. But the question remains: Is it true I have to attach a force (permanently) inside the update function?
If so I have a problem regarding my project: I have a staff (ego perspective) that can be moved left/right and up/down. By clicking a mouse button a ball should be fired out of the staff in the direction of the current x/y angle of the staff. The problem having the force used inside the update function is the following. The ball is flying away from the player but when the player is moving the mouse and changing the angle of the staff it would also affect the flying ball.
But maybe I got the whole force philosophy wrong.
I guess forces are used a lot, so wouldn’t it make sense to offer it inside the Designer as a component?
Is there a way to rename the project name (inside PROJECTS tab)?
Nice to have:
- Text support (for displaying text (flat, not 3D inside a panel, like Highscore, life, etc.)
- 2D support in general (for 2D related games)
Nevertheless, I love to work with PLAYCANVAS, you rrrrroooock, thanks a lot!