# 27 - Some idea of SimpleCarts

What is the enhancement in mind? How should it look and feel?

1.booster and brake
We can use some equations below instead of constant speed.
Example:
for booster: speed = acceleration * ( 1.0 - speed / speed_max );
or for brake: speed = speed - acceleration; if(speed<speed_min) speed = speed_min;
normal track: speed =speed - acceleration; if(speed<0.0) speed = 0.0;
speed unchanged for power track because minecraft will speed up or slow down automatically.
And I found that a minecart on the slope seems to set its velocity to (0,0,0) when speed>0.8

2.better control
The original method is use the Event"onVehicleDamage" ,and decide the direction by (Player).getLocation().getDirection(); But this vector changed only when players stop moving their mouse. If we punch the cart without stare at one point first ,the cart won't move to the direction we want.

Thus I found another function to improve the control. The function (Player).getVelocity() return vector when player move mouse or press key instantly.
So ,we can use this function in Event"onVehicleUpdate" to accelerate or decelerate minecart by press a key.

Similarly,we can use this function to implement intersection without stopping the minecart.For example , if we look forward and hold the key A ,the rail and cart will turn left ,then stop calling intersection function in the next cycle;And if player don't press any key or hold the key W ,the cart will keep the direction. But we still can change direction if we did't leave the intersection.And intersection should still work if we stop on the intersection by a T-shape intersection.

We can use this method to control a minecart which is not on the track.The minecart will become a racing car on the ground.And we can make jump function by (Player).isSneaking() ,etc.

User When Change
FlyingPikachu May 28, 2012 at 02:25 UTC Changed status from New to Started
pcco001 Apr 14, 2012 at 06:03 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

• 1 comment
• FlyingPikachu Apr 16, 2012 at 05:30 UTC - 0 likes

1. I've experimented with change in acceleration before. I might consider offering a choice of equations in the future, but for now I've decided to keep a constant speed. This is mostly because I believe the Booster would become somewhat unnecessary compared to Powered Rails. They would function too similarly.

2. This is very interesting! I'm surprised that player velocity returns anything while in a Minecart. Like you said, this seems like it'd be useful as a sort of manual control option. Thanks for the info - I'll experiment with this when I get the chance!

Thank you for the well thought-out ticket. It's rare I see someone post code along with their suggestions!

EDIT: That problem you're experiencing on slopes at speeds > 0.8 is a conflict with Minecraft. See this ticket: http:dev.bukkit.org/server-mods/simplecarts/tickets/8-minecarts-moving-upstairs-fails-with-boosters/

Last edited Apr 16, 2012 by FlyingPikachu

I have opted to discontinue all of my plugins. I have thoroughly enjoyed my time with the Bukkit community. Feel free to continue my projects!

Mouse Pokémon. Length: 1' 4", Weight: 12 lbs. By learning how to fly, Pikachu overcame its weakness to Fighting Pokémon.

• 1 comment

### Facts

Last updated
May 28, 2012
Reported
Apr 14, 2012
Status
Started - Work on this issue has begun.
Type
Enhancement - A change which is intended to better the project in some way
Priority
Medium - Normal priority.