Rick Posted February 21, 2010 Share Posted February 21, 2010 Everything I have read and tested we can't apply forces on controllers since version 2.20. I need to do knock backs on controllers. Currently I'm hacking around this by applying the force to a body box and then using PositionEntity() on the controller to the body box position (tried a fixed joint between them, but that didn't work either). This method I'm using is kind of hacky and not ideal. Quote Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted February 21, 2010 Share Posted February 21, 2010 What kind of 'knock back'? Couldn't you just have it walk backwards with a high negative movement and abruptly stop? Quote Link to comment Share on other sites More sharing options...
wh1sp3r Posted February 21, 2010 Share Posted February 21, 2010 yes, Forces and Velocities doesn't work ... it should be working Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
Rick Posted February 21, 2010 Author Share Posted February 21, 2010 That might be possible. You would have to make it jump also. The down side to that is you have to manage that over multiple frames. If it worked like other forces we can just make 1 function call to apply the force and be done with it. Having to do it over multiple frames could make the code more cumbersome to work with. Let's say I want to do this knock back to a controller. I would need to set the controllers rotation to the direction I want it to go, then supply a jump value to get it in the air and a move value to start it moving. Then I have to change the move value being passed to UpdateController() at some given point in time. Or we could just use ApplyForce() on the controller and not have to worry about it anymore. I just think this would be easier. What I did to get around this was to create a cone body and apply my force to that, then just set the controllers position to the cones position until the velocity of the cone was all 0's. The downside to that is that the controller doesn't register collisions when PositionEntity() is used on it, but in my example it doesn't matter as it's following the collisions of the cone, and it doesn't need to worry about bullets or anything while it's in the air. I think your way would work also, but managing the move value or multiple frames might prove tricky depending on your code setup. Quote Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted March 2, 2010 Share Posted March 2, 2010 I created a class that inherits the controller, thus am able to store data / properties per NPC. This allows for single frame events to be fired. With the movement at a high value for one frame, (and even a jump) the NPC can look like it's knocked back abruptly when damaged. I think your method of creating a temporary body, applying force, then setting the global position should work just fine. another idea would be getting a vector3 behind the controller, and using a Curve() math function on it. Just some ideas Quote Link to comment Share on other sites More sharing options...
Rick Posted March 2, 2010 Author Share Posted March 2, 2010 I think your method of creating a temporary body, applying force, then setting the global position should work just fine. another idea would be getting a vector3 behind the controller, and using a Curve() math function on it. The other body method works pretty well. The problem with using the Curve method is that you would still be setting the position which would kill the physics. Quote Link to comment Share on other sites More sharing options...
Canardia Posted March 2, 2010 Share Posted March 2, 2010 I think you could place a physics cloak over the player, so when the player moves, it will move with him, and when applying force the the cloak, it will move the player too. The cloak could look like a flat cylinder on top of the controller, and few flat cubes hanging on all sides of the player. The cloak parts are connected with fixed joints, but the whole cloak is not connected to the player controller, it's just laying on on him. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
wh1sp3r Posted March 2, 2010 Share Posted March 2, 2010 hehe, that's a good idea to join noncollision model with character controller you are able to apply forces ... i hate this workarounds ... Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
L B Posted August 10, 2011 Share Posted August 10, 2011 This is a feature request? Dang, I just expected it to work. +1 for that. Quote Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted August 10, 2011 Share Posted August 10, 2011 By the way the controllers work, I didn't think it was possible to be affected by physics. You would just have to update the position, but still keep the relative velocities... Quote Link to comment Share on other sites More sharing options...
gamecreator Posted August 12, 2011 Share Posted August 12, 2011 I don't know how the physics tie into the controller but slider joints seem to affect it properly. I was able to use them as moving platforms and the controller responded properly. That said, forces don't work and simply positioning the controller doesn't work (unless someone tells me otherwise). 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.