pxim
August 31, 2023, 7:55am
1
Hello!
Instead of using the camera target, parent the camera to your character root and position it accordingly: Physics V3 Simple scene with Aggregate | Babylon.js Playground (babylonjs.com)
I detached the camera controls, since what we want of the mouse movement is to rotate the character, not the camera, you just have to add that part
1 Like
pxim
September 1, 2023, 12:45am
3
In this case, the camera’s rotation zoom and so on is gone.
I want to keep these functions
pxim
September 1, 2023, 7:54am
4
I added this code, and the characters can always face the front.
But why is-1.6, I don’t understand, this value is experimented by me, is there any more correct way of writing?
And after adding this code, when holding w, i can’t move forward
You can implement the zoom manually
pxim
October 7, 2023, 5:33am
6
I still feel that the perspective of rotating characters is better,
It’s just that in this case, after pressing W, the angle is changed, but the character does not move.
Physics V5 Simple scene with Aggregate | Babylon.js Playground (babylonjs.com)
pxim
October 7, 2023, 8:02am
7
player.body.setLinearVelocity(frontVector, player.transformNode.getAbsolutePosition());
hk.setTargetTransform(player.body, player.transformNode.getAbsolutePosition(), quaternion);
These two sentences are executed at the same time,
the characters will not move,
I don’t know how to solve
hk.setTargetTransform(player.body, player.transformNode.getAbsolutePosition(), quaternion);
This line is not going to do anything, because you need to pass the position where you want the player to be , not the position they already have. See the function documentation:
And since setTargetTransform already sets the velocity of the body, you don’t need to call setLinearVelocity.
Here’s an example where I’m setting targetTransform to a desired position: Physics V5 Simple scene with Aggregate | Babylon.js Playground (babylonjs.com)
1 Like
pxim
October 12, 2023, 5:14am
9
alright, thank you very much