Soamp Posted February 20, 2010 Share Posted February 20, 2010 Hi, I've a problem with controller. I have a character who can walk around freely and drive a car with sending a "use" message. I hide it's model and controller when it's driving a car but it appears in it's old position (where it got on the car) when it get off the car. I used SetPosition on controller and set it's position to my car pivot position when it get off the car but the controller wont move! object.controller:SetPosition(carpivot:GetPosition(1),1) When I use UpdateController instead of SetPosition, the controller moves from it's original position but it's too difficult to use UpdateController to move the controller exactly wherever I want. self.controller:Update(EntityRotation(carpivot,1).y,CARSPEED.z,0, 0, 5000, 10) BTW. I'm using PiCharacter but I made some changes on it's sourcecode. I have a couple of questions : Did anyone work on getting on/off vehicles? Is there any way to use SetPosition correctly on controllers? Am I doing somthing wrong? thanks Quote Link to comment Share on other sites More sharing options...
Canardia Posted February 20, 2010 Share Posted February 20, 2010 I would just walk the controller inside the car, and have somekind of arresting mechanism to hold the controller in place. For example put some invisible physics cubes around the controller when he is inside the car, so he will move when the car moves. 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...
Rick Posted February 20, 2010 Share Posted February 20, 2010 Does the character require a controller when in the car? I wouldn't think it would, so I would just hide the controller (if that's possible) when the character gets in and unhide it when it gets out. Generally when your character gets into a vehicle the vehicle now becomes the controller. Quote Link to comment Share on other sites More sharing options...
Soamp Posted February 21, 2010 Author Share Posted February 21, 2010 here is what I've done: my character is for example in (10,10,10) behind the car: by pressing "E" he will get in the car and mesh and controller will be just invisible. I can drive to a new position like (100,100,100): in 100,100,100 I want to get out of the car. so I set character controller position to 100,100,100. but it will appear in 10,10,10: do you know why?! here is my script: Pi_Character.lua Quote Link to comment Share on other sites More sharing options...
wh1sp3r Posted February 21, 2010 Share Posted February 21, 2010 nice pictures, lol 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 Share Posted February 21, 2010 Is there any sort of parent to the controller? I guess I'd need to see the code to know why. I'm using PositionEntity() myself on the controller and it works. Quote Link to comment Share on other sites More sharing options...
Soamp Posted February 28, 2010 Author Share Posted February 28, 2010 Hi Sorry for my latency! I attached my code. Would you take a look please Thanks in advance Pi_Character.lua 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.