ok i want to use the AttachCameraToBone() command to make a scripted 3rd person player. i tried it and it seemed to work just fine (except for a bad offset of the yaw), but i noticed that i couldnt look left to right, only up and down (im VERY new to RF scripting). So i finally figured out that i had to put:
self.ideal_yaw=self.player_yaw;
ChangeYaw();
So when i go to see if my player can turn left to right, something very buggy happens. I move the mouse right, the player and camera start to turn right, then after about 70 degrees of turning, the camera starts turning left (while i keep trying to turn right), then after about 100 degrees of turning left the camera goes back to turning right (this is all happening when im trying to turn right with the mouse) . The camera seems to turn the other way only when im facing a certain direction.
After a while of testing, i think the problem lies in the fact that the camera was in first person mode (F1), but my scripted player was in "third person mode" (via the AttachCameraToBone() function). I think this is where the problem lies because i tried using the AttachCamera() function instead of AttachCameraToBone() and in first person mode the camera would rotate normally (which makes sense because the view was "first person", as in the eyes of the pawn). I know i should be in third person mode (F3) but the AttachCameraToBone() function doesn't seem to work in third person mode . Like when i use the AttachCameraToBone() function in third person mode (F3), the camera isnt attached to the the bone i specified, its just attached to the pawn like it would be if i used AttachCamera().
I guess i have a couple of questions here:
1.Does anyone know whats going on with the messed up rotation in first person mode with the AttachCameraToBone() function?
2.Does anyone know how to use the AttachCameraToBone() function in third person mode?
If anyone could help me with either of the questions it would be greatly appreciated!!
AttachCameraToBone() help...
AttachCameraToBone() help...
All your base are belong to us.
I myself havn't got to this point yet.
But I did take a look at "Sacred Druids' script, ( Thanks Pickles)
It appears that Pickles used
AttachCamera();
and
self.ideal_yaw=self.player_yaw;
ChangeYaw();
try this out and see what happens.
Keep in mind, Pickles is WAY more advanced than I am. So the script
may have alot more going on than I can see.
But I did take a look at "Sacred Druids' script, ( Thanks Pickles)
It appears that Pickles used
AttachCamera();
and
self.ideal_yaw=self.player_yaw;
ChangeYaw();
try this out and see what happens.
Keep in mind, Pickles is WAY more advanced than I am. So the script
may have alot more going on than I can see.
As for the messed up rotation thing.
I think that the player is rotating faster than the camera. So when the camera is trying to keep up with the player, the player has already
finished a full rotation then the camera is trying to adjust the angles properly.. ( I hope this is somewhat clear)
Anyway, try adjusting the self.yaw_speed up a notch ot 2.
( found in Setup[() line 52)
I put it up to 356 // 256 was the default.
This looked cleaner. But a little on the fast side of thigs. Gets ya dizzy.
I think that the player is rotating faster than the camera. So when the camera is trying to keep up with the player, the player has already
finished a full rotation then the camera is trying to adjust the angles properly.. ( I hope this is somewhat clear)
Anyway, try adjusting the self.yaw_speed up a notch ot 2.
( found in Setup[() line 52)
I put it up to 356 // 256 was the default.
This looked cleaner. But a little on the fast side of thigs. Gets ya dizzy.
Thanks for all the replays guys! :D
self.ideal_yaw=self.player_yaw;
ChangeYaw();
That seems to be one of the only ways to get your scripted third person player to turn left and right with the mouse .
After some more testing, i think the problem has to do with the camera. I figured out that the pawn itself is moving exactly as it should be, but the camera isnt staying pointing at the pawn . To fix this problem i need a way to have the camera always face the pawn. Are there any commands that rotate the camera in a certain direction or anything? If there isnt, i think there should be some commands implemented that rotate the camera to face something, or something like that. Maybe they could be something like:
RotateCameraToBone(),
RotateCameraToPawn(),
etc, etc....
I think this would definitly solve my problem and they dont seem like they would be that hard to implement, but im no programmer so its probably harder then i think, and if it was so easy, they would probably already be implemented . But none the less, i think these commands would definitly solve my problem and would probably be useful for lots of other things too. Anyways, just an idea...
I think the person who i would have to ask to help me solve my problem would be pickles, but he doesnt seem to post on this forum too often .
Anyways, thanks for all the help guys! :D
If anybody else has any ideas or knows how to rotate the camera, any help would be great! Thanks!
What exactly do you mean by two pawns?Pickles suggested using two pawns instead of one to fix the rotation problem, so you should probably give that a go, since he's right 99% of the time.
Actually AttachCamera() works perfectly! The thing is though, i want to use AttachCameraToBone() for a more of a "customized" third person view, if you catch my drift. This is where im having all the problems. And yes i am usingIt appears that Pickles used
AttachCamera();
and
self.ideal_yaw=self.player_yaw;
ChangeYaw();
try this out and see what happens.
self.ideal_yaw=self.player_yaw;
ChangeYaw();
That seems to be one of the only ways to get your scripted third person player to turn left and right with the mouse .
I did this, but all it did was set the camera view to thirdperson when you first start the map. When you switch to firstperson (which is what AttachCameraToBone() uses, it still has the same problem. Thanks anyways for the reply!One criteria for the scripted player (at least Pickles' scripted player) is the LevelViewPoint (within the PlayerSetup parameters - added in editor, not script) must be set to 1.
Ya, actually the self.yaw_speed can be as high as you want because the higher the number, the faster it matches the player rotation. ie, this doesnt affect the mouse sensitivity at all ( my self.yaw_speed is 1000 ). All it affects is the speed at which the pawn rotates to face the same direction as the player. The pawn will NEVER rotate faster then the player so this number can be as high as you want. So technically speeking, the self.yaw_speed should be set to something like AT LEAST 300 unless you want to have to wait for the pawn to finish rotating like a second after your finished moving the mouse . But just to be on the safe side, i tried setting the self.yaw_speed to 356 like you said, but still same problem. Thanks for the help none the less .I think that the player is rotating faster than the camera. So when the camera is trying to keep up with the player, the player has already
finished a full rotation then the camera is trying to adjust the angles properly.. Shocked ( I hope this is somewhat clear)
Anyway, try adjusting the self.yaw_speed up a notch ot 2.
( found in Setup[() line 52)
I put it up to 356 // 256 was the default.
After some more testing, i think the problem has to do with the camera. I figured out that the pawn itself is moving exactly as it should be, but the camera isnt staying pointing at the pawn . To fix this problem i need a way to have the camera always face the pawn. Are there any commands that rotate the camera in a certain direction or anything? If there isnt, i think there should be some commands implemented that rotate the camera to face something, or something like that. Maybe they could be something like:
RotateCameraToBone(),
RotateCameraToPawn(),
etc, etc....
I think this would definitly solve my problem and they dont seem like they would be that hard to implement, but im no programmer so its probably harder then i think, and if it was so easy, they would probably already be implemented . But none the less, i think these commands would definitly solve my problem and would probably be useful for lots of other things too. Anyways, just an idea...
I think the person who i would have to ask to help me solve my problem would be pickles, but he doesnt seem to post on this forum too often .
Anyways, thanks for all the help guys! :D
If anybody else has any ideas or knows how to rotate the camera, any help would be great! Thanks!
All your base are belong to us.