Jump to content

Forcing player to look up or down


gulogulo

Recommended Posts

I don't know why but this solution seems a bit complicated :D

 

 

Scriptname Test extends ObjectReference

Activator Property FXEmptyActivator1 Auto
Activator Property FXEmptyActivator2 Auto

ObjectReference Target1
ObjectReference Target2

Function LookUp()

FXEmptyActivator1 = Game.GetFormFromFile(0x000B79FF, "Skyrim.esm") as Activator
actor Player = Game.GetPlayer()

float APosX = (70 + Player.GetPositionX())
float APosY = Player.GetPositionY()
float APosZ = (300 + Player.GetPositionZ())

Target1 = Player.PlaceAtMe(FXEmptyActivator1)
Target1.SetPosition(APosX, APosY, APosZ)

Player.SetLookAt(Target1, 1)
;Target1.Delete()

EndFunction

Function LookDown()

FXEmptyActivator2 = Game.GetFormFromFile(0x000B79FF, "Skyrim.esm") as Activator
actor Player = Game.GetPlayer()

float BPosX = (70 + Player.GetPositionX())
float BPosY = Player.GetPositionY()
float BPosZ = (-300 + Player.GetPositionZ())

Target2 = Player.PlaceAtMe(FXEmptyActivator2)
Target2.SetPosition(BPosX, BPosY, BPosZ)

Player.SetLookAt(Target2, 1)
;Target2.Delete()

EndFunction

 

Link to comment
Share on other sites

Yeah, you actually can like Cubedj21 with the "SetLookAt" function, doesn't need to be an activator, it can be any kind of object of reference but you still need a target - just don't forget to use "ClearLookAt" afterwards or your actor will never take his eyes off the target ;)

Link to comment
Share on other sites

yep, most likely - although I'm not sure what would happen if the target object reference will be deleted... but to keep things clean is better to use "ClearLookAt" anyway ;)

Link to comment
Share on other sites

one more thing - I'm not sure about compatibility in case of the player reference since it is not the same thing like any other NPC...

Link to comment
Share on other sites

Well, the script as it is wouldn't work because it needs a triggering event to activate the actor - but the functions you suggested were relevant. The event could be triggered by a spell, lesser power, triggetbox, activator, quest... lots of options actually.

Link to comment
Share on other sites

I'm aware that the script won't work like this... well, it can be compiled without any errors and you can always call these functions from some other quest/script/event.... what I meant is that the player is controlled by your input and not by the game like any other NPC... but the documentation says it is "forcing" any actor to "look at" something... so it should work even for the player actor...

Link to comment
Share on other sites

Yes, it does work for the player, absolutely (it still looks kind of strange though, 'cause he's more "staring" than looking - I gave up using it in the end) - and you can also get the player to be controlled by the game like an NPC by using "DisablePlayerControls" (then "EnablePlayerControls") - or "SetPlayerAIDriven" - but it shouldn't be necessay to make him look down or up.

 

Actually, to answer Gulogulo's question here, we'd need to know what exactly he's trying to achieve here - and in which circumstances.

 

The tricky part about this though is that it may interfere of even conflict with very popular mods like PlayerHeadTracking for instance which has scripts constantly running to track targets - so it's best used cautiously.

Link to comment
Share on other sites

@All

 

Thank you. I will try your proposals.

 

 

@Hoamaii

 

Im currently making a flight system for my new winged race called Dragorian. To be specific flying is already made. Now its time for gliding. Because when gliding you cannot in general gain altitude I want the player to look at least slightly down while gliding. The best would be to make the player gradually lower gaze to appropriate level.

Link to comment
Share on other sites

Oh, I see, I experimented "gllding" effects recently (mostly using Game.SetGameSettingFloat to modify the jump and fall settings) - I'd be interested to find what other ways you have been trying to create that effect... :happy:

 

Anyway, if you're using the fall or jump, these are already animations events, most of the time the player looks down in these - but more like looking at his own feet than looking at where he is going.

 

Again, as far as my knowledge goes about this, the most delicate part about it would be not to risk conflicting with Player HeadTracking, which many players have installed and can be pretty unstable at times. That's the main reason why I gave up using "SetLookAt". Other than that, Cubedj's suggestion to place targets along the player's path (then later delete them) would probably work.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...