[Include] [INC] Smooth Object Rotating
#1

Smooth Object Rotating

What does it do?
With this include you can ROTATE objects slowly.
It's so easy to understand so there are no pics or vids included.

Functions
pawn Код:
native RotateObject(Objectid, Float:RotX, Float:RotY, Float:RotZ, Float:Speed=2.0);
Callbacks
pawn Код:
public OnObjectRotated(objectid)
Editable things
You can change the time to wait to update again.
Default is 10 miliseconds.
Just define SRO_UPDATE_TIME to the value you want.
this example changes the update time to 5 miliseconds:
pawn Код:
#include <a_samp>
#include <SRO>

#define SRO_UPDATE_TIME 5
Don't set it to low because, it's takes more memory if the update time is low.

Update history
  • V1.0: First public release
License
Dutch License:
SRO van NoZer0 is in licentie gegeven volgens een Creative Commons Naamsvermelding-Geen Afgeleide werken 3.0 Nederland licentie.
Gebaseerd op een werk op www.mediafire.com en nozer0.pastebin.com.

English License:
SRO by NoZer0 is licensed under a Creative Commons Attribution-No Derivative Works 3.0 Unported License.
Based on a work at www.mediafire.com and nozer0.pastebin.com.


Download
http://www.mediafire.com/?imjznygyz3g
http://nozer0.pastebin.com/f7e7141c7

How to install
Download SRO.inc from mediafire and put it in the "server">"pawno">"include" folder.
Put this above in your gamemode
pawn Код:
#include <SRO>
And you're done, Now you can use all the functions in your gamemode

Bugs
When rotating, players get a higher ping, don't know how to fix this.

Others
  • Please post your comments about this. I want to improve what i got now.
  • Sorry for my bad english, i am dutch
Reply
#2

I was just in progress in making that .
Good job anyways.
Reply
#3

Quote:
Originally Posted by SpiderPork
I was just in progress in making that .
Good job anyways.
lol, thx, i created it in 20 minutes or somthing like that.
Reply
#4

Good job, This will be quite useful.
Reply
#5

Very Usefull
Reply
#6

Nice! Time for rotating doors.

Leopard
Reply
#7

Pastebin dead
Reply
#8

Quote:
Originally Posted by Weirdosport
Pastebin dead
Fixed: http://nozer0.pastebin.com/f7e7141c7
Updated first post
Reply
#9

It looks like it will finish each rotation at different times.. Asif it might start rotating in all 3 axes, then down to 2, then 1 until it's moved from start -> finish. This might appear bit jerky if you're dealing with an object with poor rotational symmetry (eg. not a sphere).

It might also go the long way around when trying to reach a point. If you wanted to get from 350° to 340° it might go round the long way as opposed to moving 10 degrees. - Ignore that
Reply
#10

nice
Reply
#11

Quote:
Originally Posted by Weirdosport
It looks like it will finish each rotation at different times.. Asif it might start rotating in all 3 axes, then down to 2, then 1 until it's moved from start -> finish. This might appear bit jerky if you're dealing with an object with poor rotational symmetry (eg. not a sphere).

It might also go the long way around when trying to reach a point. If you wanted to get from 350° to 340° it might go round the long way as opposed to moving 10 degrees. - Ignore that
It will rotate all axes at the same time.
Reply
#12

To start with, but if you want one to rotate 180 degrees and 1 of them 90 degrees, once the 90 is done it will change the direction of rotation.
Reply
#13

Quote:
Originally Posted by Weirdosport
To start with, but if you want one to rotate 180 degrees and 1 of them 90 degrees, once the 90 is done it will change the direction of rotation.
I know, so you mean you want a diffrent speed for the one of 90 degrees?
Reply
#14

Would look better if all the rotations finished at the same time
Reply
#15

SWEET!

Just what I needed, thanks a lot.
Reply
#16

actually, using tick counts and timer don't will show the best result
timers are "eating" server resourses
GetTickCount()-oldvalue can return 0, because of small load of server
sorry for bad english
In my opinion - fail
Reply
#17

I had a working test script but went gone

Anyway I found an old copy of it which isn't working :

pawn Код:
#include <a_samp>
#include <SRO>

new exist, obj, x, y, z;

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Soft Object Rotation, Test");
    print("--------------------------------------\n");
    exist = 0;
    return 1;
}

public OnFilterScriptExit()
{
    exist = 0;
    return 1;
}

public OnObjectRotated(objectid)
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/make", cmdtext, true, 5) == 0)
    {
        if(exist == 0){
            GetPlayerPos(playerid, x, y, z);
            obj = CreateObject(987,x-2,y+2,z+3,0,0,0);
            exist = 1;
        }else{
            SendClientMessage(playerid, 0xFF4411FF, "You must delete the test thing to create a new one!");
        }
        return 1;
    }
    if(strcmp("/del", cmdtext, true, 4) == 0)
    {
        if(exist == 1){
            DestroyObject(obj);
            exist = 0;
        }else{
            SendClientMessage(playerid, 0xFF4411FF, "There is nothing to delete!");
        }
        return 1;
    }
    if(strcmp("/rotx", cmdtext, true, 5) == 0)
    {
        if(exist == 1){
            RotateObject(obj, 20, 0, 0, 2.0);
        }else{
            SendClientMessage(playerid, 0xFF4411FF, "There is nothing to rotate!");
        }
        return 1;
    }
    return 0;
}
Reply
#18

How can i rotate CCW? I tried negative values, and negative speed, but nothing works.
Reply
#19

This tends to shake the object after the first roation... SO, if someone made a new version, I'd be truly thankful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)