Results 1 to 8 of 8
  1. #1
    Skaarj
    Join Date
    Nov 2010
    Location
    Sweden
    Posts
    17

    Default light sensitivity

    Hi

    We are trying to make a monster that avoids light, more exactly light from the players flashlight (which is a SpotLightMovable).

    All that‘s needed is to check if the monster is in an illuminated area or not. Preferably this is done by actually checking how illuminated it is, alternative is to fake this by checking if the monster is within the arc of light that the flashlight casts.

    Any help with how to do this is appreciated
    Thanks.
    Last edited by Silve; 04-18-2011 at 08:54 AM.

  2. #2
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,936
    Gamer IDs

    Gamertag: ambershee

    Default

    You'll have to fake it. Try setting up some kind of collision primitive in where your light source is, then using traces to see if there is any obstruction between the monster and light source.

  3. #3
    Iron Guard
    Join Date
    Jun 2009
    Location
    Where the ganja is plentiful
    Posts
    715
    Gamer IDs

    Gamertag: PSN: ShurikenUK

    Default

    Cool idea mate, reminds me of scenes from Condemned, those wierd little anorexic mutated crack addicts (or whatever they were). One of the scariest games ever made, without a doubt!
    There is no religion except that of Music. There is no god, except that of your own will to create music.
    -Ancient Texts of Truth

  4. #4
    Skaarj
    Join Date
    Nov 2010
    Location
    Sweden
    Posts
    17

    Default

    I have got a trace working that originates from the playerPawn, but I want it to originate from the flashlight. The problem is that the flashlights position and rotation never changes, I guess it have to do with it being attached to the player? Is there any solution for this?

  5. #5
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,936
    Gamer IDs

    Gamertag: ambershee

    Default

    The flashlight position / rotation has to change, because it is attached to the player.

    Are you confusing world and local coordinate systems somewhere?

  6. #6
    Skaarj
    Join Date
    Nov 2010
    Location
    Sweden
    Posts
    17

    Default

    Yes of course but when I try to get its location and rotation it is always the same even when I move around.

  7. #7
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,936
    Gamer IDs

    Gamertag: ambershee

    Default

    Sounds like you're trying to get the position of the wrong object, or something similar. You'll have to post code if you want someone to help you.

  8. #8
    Skaarj
    Join Date
    Nov 2010
    Location
    Sweden
    Posts
    17

    Default

    Right, well this is my code so far. It is located within my playerPawn, mostly because I want those 3D lines to be drawn and I don't know any better way to get hold of the HUD.

    Code:
    var AU_Flashlight flashlight;
    
    event Tick(float DeltaTime)
    {
    	flashlight = AU_Flashlight(InvManager.FindInventoryType(class'AU_Flashlight'));
    	
    	Pos = flashlight.Location + (vector(flashlight.Rotation)*300);
    	
    	hitActor = Trace(HitLocation, HitNormal, Pos, flashlight.Location, FALSE,, hitInfo);
    	//hitActor = Trace(HitLocation, HitNormal, Pos, Location, FALSE,, hitInfo);
    
    	Paint.G=0;
    	Paint.B=0;
    	Paint.R=100;
    	AU_PlayerController(Controller).DrawTraceLine(HitLocation,Pos, Paint);
    	Paint.G=100;
    	Paint.B=0;
    	Paint.R=0;
    	AU_PlayerController(Controller).DrawTraceLine(flashlight.Location,HitLocation, Paint);
    }
    I have tested and it does find the right flashlight.
    Last edited by Silve; 04-22-2011 at 04:45 AM.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.