Results 1 to 6 of 6
  1. #1
    Deathless
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    2,167

    Default Getting Last Player Rotation (theRotationOfMovingTheMouse) from an input to input

    So i want to get the last x and y vector that player did move from the mouse , from when i Pressed the left mouse button from when i released it.


    I have no idea from where to start , what variables to touch , what vars store arleady that info , how do i capture that mouse input , the x and y

    also then after that i want to get if it was

    a Up movement ( user moved mouse up )
    a Down movement ( user moved mouse up )
    a Rightmovement ( user moved mouse up ) a
    Left movement ( user moved mouse up ) a

    I have no idea on how i would process the mouse input x and y to assign that variables with a control statement

    if...

    Should i use vectors?






    Help !

  2. #2
    The Sacrifice
    Join Date
    Jul 2011
    Location
    Sweden
    Posts
    370

    Default

    Here is one way to do it in an extended PlayerController, should get you started...

    Code:
    event PlayerTick( float DeltaTime )
    {
    	local vector mouseVect, upVect, rightVect;
    
    	upVect = vect(0,1,0); // (not sure up is positive for mouse stuff)
    	rightVect = vect(1,0,0);  // (not sure right is positive for mouse stuff)
    	
    
    	mouseVect = vect(PlayerInput.aMouseX, PlayerInput.aMouseY, 0);
    
    	if (mouseVect dot upVect > 0)
    	{
    		// mouse was moved up
    	}
    	else if (mouseVect dot upVect < 0)
    	{
    		// mouse was moved down
    	}
    	if (mouseVect dot rightVect > 0)
    	{
    		// mouse was moved right
    	}
    	else if (mouseVect dot rightVect < 0)
    	{
    		// mouse was moved left
    	}
    
    	super.PlayerTick(DeltaTime);
    }

  3. #3
    Deathless
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    2,167

    Default

    Thanks that looks Useful : )

  4. #4
    Deathless
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    2,167

    Default

    I get error line 16 error missing compnent x of vector ?? -> mouseVect = vect(PlayerInput.aMouseX, PlayerInput.aMouseY, 0);


    What does the KeyWord vect???

    What does that dot betwwen those inputs??? function?

    Is there Anyway to convert a negative number in the code in positive nubmer , if i know that i can get it : ) ;
    Last edited by Neongho; 08-07-2012 at 07:38 PM.

  5. #5

  6. #6
    Deathless
    Join Date
    May 2012
    Location
    Barcelona
    Posts
    2,167

    Default

    Code:
     //captureMouseInput
    event PlayerTick( float DeltaTime )
    {
    
    
        Local float Right;
        Local float Left;
        Local float Up;
        Local float Down;
    
    
          WorldInfo.game.Broadcast(self,LastMouseInput);
    
    	if (PlayerInput.aMouseX > 0)
    	{
    
    	   Right=PlayerInput.aMouseX;
           left=0;
    
    
    	}
    	if (PlayerInput.aMouseX < 0)
    	{
        left=Abs(PlayerInput.aMouseX);
        Right=0;
    	}
    
    
    
    	//wich one wins
    
    	if(Right>left)
    	{
    	 LastMouseInput="Right";
        }
    
        if(Left>Right)
    	{
    	 LastMouseInput="Left";
        }
    
    
    
    
    
    
        WorldInfo.game.Broadcast(self,LastMouseInput);
    
    
    
        super.PlayerTick(DeltaTime);
    
    
    }
    this works, next time i'll search object for this matehmaticall things , sorry , didn't know where exacly to look for


 

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.