Log in

View Full Version : How do I rotate the camera?



mrbarrybadger
06-03-2012, 10:02 PM
Basically i have my script fully functioning except i want it to be able to rotate the screen if the object is not found and im not sure how to do this, i know there is a rotation function for finding an object but ive already set it up and am using a 'If,Then,Else' 'else' system and simply need to know the process to rotate the camera for the else if that makes sense :/

thanks in advance :)

Nebula
06-03-2012, 10:04 PM
if not find object then
MakeCompass(angle)

Rich
06-03-2012, 10:07 PM
function MakeCompass(Direction: Variant): Boolean;:)

mrbarrybadger
06-03-2012, 10:17 PM
thanks guys :) but im really struggling with trying to implement it into my script, lets say i just wanted it to rotate 180 degrees how would i do that?

Rich
06-03-2012, 10:41 PM
var
Original, New : Extended;

begin
Original:= rs_GetCompassAngleDegrees;
if Original > 180 then
New:= Original - 180
else
New:= Original + 180;
MakeCompass(New);
end; Should do the trick.

P1ng
06-03-2012, 10:57 PM
Try usingfunction CompassMovement(MinMovement, MaxMovement: Integer; Return: Boolean): Boolean;
MinMovement = Smallest compass movement in degrees
MaxMovement = Largest compass movement in degrees
Return = True/False do you want to return to original compass angle

if not FindObject then
CompassMovement(10,180,False);
This would rotate the compass between 10-180 degrees if the object is not found

Rich
06-03-2012, 11:05 PM
Didn't even know that existed...Oh well! :p

P1ng
06-03-2012, 11:18 PM
It's hiding away in the antiban include, that's why ;)

Rich
06-03-2012, 11:19 PM
Weird place for it to be, no?

Wreck
06-03-2012, 11:20 PM
(*
MakeCompass
~~~~~~~~~~~
.. code-block:: pascal
function MakeCompass(Direction: Variant): Boolean;
Aligns RS to specified direction
- Enter a compass angle ('n', 's', 'e', 'w') or degree (23.3, 25, 205.2)
and it will move the compass to that angle. Also accepts 'random',
and 'rand' to make the compass a random direction.

.. note::
by Nielsie95 & Nava2

Example:
.. code-block:: pascal

// using a string!
MakeCompass('N');

// using an integer!
MakeCompass(0);

*)

Hope that helps.

mrbarrybadger
06-03-2012, 11:21 PM
thanks again very helpful :)

P1ng
06-03-2012, 11:22 PM
Weird place for it to be, no?

Completely agree, it makes sense to an extent that it would be used to look more human-like but it has so many other great uses like for this situation.