Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle physics #155

Open
Gjum opened this issue Sep 28, 2015 · 8 comments
Open

Vehicle physics #155

Gjum opened this issue Sep 28, 2015 · 8 comments

Comments

@Gjum
Copy link
Member

Gjum commented Sep 28, 2015

Create the API for moving around while in a Minecart, boat or horse etc. - started in interact plugin

Check for compatibility with physics. - done, works

@Gjum
Copy link
Member Author

Gjum commented Sep 28, 2015

We have that in the interact plugin, but maybe it should go into movement, and I'm also not sure if it works together with the physics plugin right now.

@nickelpro
Copy link
Member

Physics suspends itself when Spockbot is mounted on a Vehicle. I have no problem with this stuff staying in interact or movement. But if the vehicle movement is truly based on the client's yaw than we should have a way to translate between absolute (move positive x, negative z) and relative (forward, backwards) so plugins that want absolutle movement don't have to mess with yaw.

Example:
A bot controlling a boat probably doesn't want to mess with head direction and forward/backwards. It just wants to move in a certain direction. We should automagically handle the head yaw

@Gjum
Copy link
Member Author

Gjum commented Jan 5, 2016

plugins that want absolutle movement don't have to mess with yaw

👍

@Gjum
Copy link
Member Author

Gjum commented Jan 7, 2016

Two options when moving north when looking west:

  1. look north, steer forward -- more precise for controlling boats
  2. keep looking west, steer sideways -- works nicely when the vehicle can be steered equally in every direction (horses)

It should also be noted that when a steering packet is sent and the yaw changes after that, the intended movement might not be achieved, because the server always uses the current yaw to calculate movement and not only the yaw when receiving the steering packet.

I prefer 1, although 2 might be useful in cases where having a certain yaw is important (block placement, NCP).

@Gjum Gjum self-assigned this Jan 7, 2016
@Gjum
Copy link
Member Author

Gjum commented Jan 8, 2016

@nickelpro is it ok with you if I put the vehicle controls into Physics.move_*() and .jump() etc.?

That makes sense for me, because when physics is suspended, movement happens by sending Steer Vehicle rather than Player Position.

It makes the plugin more complex though.

@Gjum
Copy link
Member Author

Gjum commented Jan 8, 2016

When riding a minecart, look and steer get sent every tick (even when they don't change), but position doesn't:

# not mounted, normal movement packets
# if nothing changes, position gets sent every second
client->server: play position : {"x":197.43847190544113,"y":70.63409999847413,"z":124.5,"onGround":false}
client->server: play position : {"x":197.43847190544113,"y":70.47886799395752,"z":124.5,"onGround":false}
client->server: play position : {"x":197.43847190544113,"y":70.24834062504456,"z":124.5,"onGround":false}
client->server: play position : {"x":197.43847190544113,"y":70,"z":124.5,"onGround":true}
# just turning the head sends look once per tick, position keeps getting sent every second
client->server: play look : {"yaw":-207.23580932617188,"pitch":8.699928283691406,"onGround":true}
client->server: play look : {"yaw":-207.23580932617188,"pitch":9.149928092956543,"onGround":true}
client->server: play look : {"yaw":-207.23580932617188,"pitch":11.249927520751953,"onGround":true}
client->server: play look : {"yaw":-198.68580627441406,"pitch":34.649925231933594,"onGround":true}
client->server: play look : {"yaw":-187.13580322265625,"pitch":59.69992446899414,"onGround":true}
client->server: play look : {"yaw":-168.5358123779297,"pitch":90,"onGround":true}
client->server: play look : {"yaw":-154.5858154296875,"pitch":90,"onGround":true}
client->server: play look : {"yaw":-153.0858154296875,"pitch":90,"onGround":true}
# moving while turning the head sends position_look once per tick
client->server: play position_look : {"x":197.43847190544113,"y":70.7125,"z":124.5,"yaw":-207.23580932617188,"pitch":8.84992790222168,"onGround":false}
client->server: play position_look : {"x":197.43847190544113,"y":70.7125,"z":124.5,"yaw":-207.23580932617188,"pitch":8.84992790222168,"onGround":false}
client->server: play position : {"x":197.43847190544113,"y":70,"z":124.5,"onGround":true}
client->server: play position_look : {"x":197.43847190544113,"y":70.7125,"z":124.5,"yaw":-207.23580932617188,"pitch":8.84992790222168,"onGround":false}
client->server: play position : {"x":197.43847190544113,"y":70,"z":124.5,"onGround":true}
client->server: play position : {"x":197.48283567607507,"y":70,"z":124.4126166254282,"onGround":true}
client->server: play position : {"x":197.55142206828864,"y":70,"z":124.2775219227984,"onGround":true}
client->server: play position : {"x":197.6332340134209,"y":70,"z":124.11637683202311,"onGround":true}
# mounting a minecart
client<-server: play.attach_entity :{"entityId":31,"vehicleId":1,"leash":false}
# different packets get sent: look and steer_vehicle once per tick, but never position or position_look
client->server: play look : {"yaw":-181.43585205078125,"pitch":36.14994812011719,"onGround":false}
client->server: play steer_vehicle : {"sideways":0,"forward":0,"jump":0}
client->server: play look : {"yaw":-181.43585205078125,"pitch":36.14994812011719,"onGround":false}
client->server: play steer_vehicle : {"sideways":0,"forward":0,"jump":0}
# etc ...

This means the Physics plugin should handle vehicle movement completely IMO.

@Gjum
Copy link
Member Author

Gjum commented Jan 17, 2016

started in Gjum@vehicle-physics

@Gjum Gjum removed their assignment Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants