Smoothly door rotating help needed
#1

Hey there!

I'm started to make a new skin selector system like in singleplayer but i'm close to get a headache becouse i can't rotate the door smoothly. If i add a low value whenever i moving the object, the rotating almost equal with nothing, or it will too fast (i added values less than 0.05). Whenever i add more >= 0.05 to Z the door will move smoothly but it will ugly becouse it's easily to notice if it's height increasing. My second problem is that, whenever OnDynamicObjectMoved called, the object stops for a few ms, and it's also very ugly. I don't know how should i solve this, but i have a few idea, but i need your advices too.

I'd like to create this opening door effect.
https://*********/iJQHtPRXy2I?t=50s

Whenever it's reach its RZ + maybe 65-75 value the object should move a little with a slower speed.
But as i said, whenever the object reachs that value, it will stop for a few ms, and start moving again a little bit.

So if i right i know how to make that you can see on the video, but i dont know how to rotate and sadly i dont have so much time to deal with this problem on my own.
So guys u hope you could help me / know a value which is enough to rotate the object smoothly 😃

Thanks
Reply
#2

Try down 10 percent
Reply
#3

u mean 0.10? that's too high or what
Reply
#4

type 0.5, you take 10 percent of 0.5 = 0.05 or more high, will testing.
Reply
#5

oh!
yes, i've tried different values before opened this thread
if i set low value, the door object wont move, just jump from A to B pos
Reply
#6

Quote:
Originally Posted by m4karow
Посмотреть сообщение
oh!
yes, i've tried different values before opened this thread
if i set low value, the door object wont move, just jump from A to B pos
You can, of course, try and make some timer for, let's say, 100 ms and then just basically rotate the door on some calculated angle depending on the iteration done right now. It might not be the best way, but it'll do the trick.
What I mean is, since you can't make the smooth transition between the positions desired, change its position on a slight angle in a small period of time, and it will roughly replicate smooth movement. You can go overhead and actually use it for smooth movement via smaller timers and angles combinations there, too, even - that is, if you want.

And you can reuse such thing for any door later, too.
Reply
#7

I guessed that i should use timer for this... But it'll be more better if i could do this without it
Reply
#8

moveobject is the key to what you want to achieve and as the others said
use a shorter time so that it opens slowly
Reply
#9

The doors have fixed rotation points and angles, you can't move them oppositely and they will move instantly if done. Show us the code and I'll try to help since I've worked with the door movements previously in my other RP script.
Reply
#10

Now the rotating is fine, but whenever ondynamicobjectmoved called the rotating stops for a few ms... :/

Код:
CreateSkinSelector(2873, 213.87820, -39.86030, 1002.20001, 0.00000, 0, 1);//Suburban
Код:
SkinSelector[selectorid][skinselObject] = CreateDynamicObject(2873, 213.87820, -39.86030, 1002.20001, 0.00000, 0, 1, .streamdistance = 100.0);
Код:
Function:ToggleSkinSelector(selectorid)
{
	if(!SkinSelector[selectorid][skinselUsed])
	{
		SkinSelector[selectorid][skinselMoves] = 1;
		MoveDynamicObject(SkinSelector[selectorid][skinselObject], SkinSelector[selectorid][skinselX], (SkinSelector[selectorid][skinselY] + 0.05), SkinSelector[selectorid][skinselZ], DOOR_MOVING_SPEED, 0.0, 0.0, (SkinSelector[selectorid][skinselA] + 65.0));
	}
}
Код:
public OnDynamicObjectMoved(objectid)
{
	switch(SkinSelector[selectorid][skinselMoves])
	{
		case 1:
		{
			SkinSelector[selectorid][skinselMoves]++;
			MoveDynamicObject(SkinSelector[selectorid][skinselObject], SkinSelector[selectorid][skinselX], SkinSelector[selectorid][skinselY], SkinSelector[selectorid][skinselZ], (DOOR_MOVING_SPEED / 2), 0.0, 0.0, (SkinSelector[selectorid][skinselA] + 5.0));
		}
		case 2:
		{
			SkinSelector[selectorid][skinselMoves]++;
			MoveDynamicObject(SkinSelector[selectorid][skinselObject], SkinSelector[selectorid][skinselX], SkinSelector[selectorid][skinselY] - 0.05, SkinSelector[selectorid][skinselZ], DOOR_MOVING_SPEED, 0.0, 0.0, (SkinSelector[selectorid][skinselA] - 15.0));
		}
		case 3:
		{
			SkinSelector[selectorid][skinselMoves]++;
			MoveDynamicObject(SkinSelector[selectorid][skinselObject], SkinSelector[selectorid][skinselX], SkinSelector[selectorid][skinselY], SkinSelector[selectorid][skinselZ], (DOOR_MOVING_SPEED / 2), 0.0, 0.0, (SkinSelector[selectorid][skinselA] - 5.0));
		}
		case 4:
		{
			SkinSelector[selectorid][skinselMoves]++;
			MoveDynamicObject(SkinSelector[selectorid][skinselObject], SkinSelector[selectorid][skinselX], SkinSelector[selectorid][skinselY] - 0.05, SkinSelector[selectorid][skinselZ], (DOOR_MOVING_SPEED / 2), 0.0, 0.0, (SkinSelector[selectorid][skinselA] + 2.25));
		}
		case 5:
		{
			MoveDynamicObject(SkinSelector[selectorid][skinselObject], SkinSelector[selectorid][skinselX], SkinSelector[selectorid][skinselY], SkinSelector[selectorid][skinselZ], (DOOR_MOVING_SPEED / 2) , 0.0, 0.0, SkinSelector[selectorid][skinselA]);
		}
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)