Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / gun in front of camera 3D

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 1st Sep 2016 08:29 Edited at: 2nd Sep 2016 23:57
Been trying to have a gun,or indeed anything like a simple block to use as one,to follow the player, the player in this case is a character controller using physics,I have the player moving using th left joystick to move the character controller whilst the right joystick rotates the character controller, the camera simply gets set to the position of the controller and its rotation set to that of the player every loop:
So this is what I have so far:


The code has gotten a little messy as I was trying different stuff!
I just need to somehow get a gun to follow and rotate correctly with everything else!
Hail to the king, baby!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 1st Sep 2016 12:56
I would position and angle the gun with the player object, or camera in FPS style games - then use the local movement commands to offset it.

So, if you wanted a turret on top of that sphere, you could position the turret at the sphere position, rotate it to suit the sphere, then MOVEOBJECTLOCALY(obj,dist) to stick it on top, then you could even rotate the turret again to suit the aiming angle. You can move the object on any axis to offset it.
The code is dark and full of errors
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 2nd Sep 2016 23:58
sorry that was wrong video,I have so many,that one was a different game mode of the editor,updated with the correct one
Hail to the king, baby!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 3rd Sep 2016 01:47
I think I understand what you want. I do this code below to create a box and attach it to the character controller
as a limb. Then I position the camera at the box location for a chase camera. You can do the same fro a gun in front.

The coffee is lovely dark and deep,and I have code to write before I sleep.
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 4th Sep 2016 18:24
Yeh,that was kinda it! thanks,
the problem is though the gun itself has no physics,despite me even setting one before fixing to object of character controller,so this means it can go straight through walls, also how then would I move the gun object to look with the camera! which is now rally only part of the character controller! thanks for any help gain.
Hail to the king, baby!

Login to post a reply

Server time is: 2024-11-25 03:24:23
Your offset time is: 2024-11-25 03:24:23