Firestarme Posted February 8, 2013 Share Posted February 8, 2013 Ive been trying to make a vehicle mod, but the only way i can find of allowing the player to control motion is by using the mounted entity's motion values. What i want to achieve is for the ws keys to control forward/backward motion and for the ad keys to steer it. Is there any way of tapping in to the player's key handler so it can be used to control the car ? Quote http://www.mcportcentral.co.za/add_images/mcportcentral-banner.jpg[/img] Link to comment Share on other sites More sharing options...
opssemnik Posted February 9, 2013 Share Posted February 9, 2013 u can check the motion, the position, create a key handler, there are a lot of methods... Quote Link to comment Share on other sites More sharing options...
Firestarme Posted February 11, 2013 Author Share Posted February 11, 2013 u can check the motion, the position, create a key handler, there are a lot of methods... My current system uses motion, but that only gets what direction the player is trying to move, not what keys are being pressed ( i may try to separate the motion in to two vectors representing ad & ws but i recon there is an easier way to do this). Position is much the same as motion, and would be very hard to resolve back to the original keys. Finally, a key handler was my first idea for controlling motion, unfortunately, it overrides vanilla key bindings so when the player exits the car, they can no longer move. Quote http://www.mcportcentral.co.za/add_images/mcportcentral-banner.jpg[/img] Link to comment Share on other sites More sharing options...
ZetaHunter Posted February 11, 2013 Share Posted February 11, 2013 Why not set it to custom controls via keybinding them? Just like BMW Car mod does it, they dont override the vannila controls, they present own control setting for users. Quote ~I was here~ Link to comment Share on other sites More sharing options...
Taigore Posted February 12, 2013 Share Posted February 12, 2013 If you want to know when the key binding assigned to move forward/backward/etc. is pressed, you should check (client side) when FMLClientHandler.instance().getClient().gameSettings.keyBindForward.pressed is true. GameSettings holds all the vanilla keybinds, and that way you'll always know when the right key is pressed, even if the player ever changes it. Then you need to relay the info to the server, but it seems to me you already know how to do that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.