Rotate a spawned model?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Altusi
Lance Corporal
Posts: 13
Joined: Sat Mar 24, 2007 5:08 pm

Rotate a spawned model?

Post by Altusi »

Hello, it's me again! :)
(i am curious because i try to understand how it work, so sorry for my multiple topics)

So now i spawn and delete a model with a script (i learn it alone! lol Thanks again jv_map!)
And my problem now it's i can't find the command to rotate a model, because my model is not in the good orientation. (see picture: the green is my actual model. And i want that the model spawn in the same position like the red on the picture).
Image

How i can do that in the script?
Thanks

Al

edit:
i can put a part of my script:

Code: Select all

main:

    // set scoreboard messages
setcvar "g_obj_alliedtext1" "Southern France"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm1"

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread
		
	level waitTill prespawn

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	level.script = maps/dm/mohdm1.scr
	exec global/ambient.scr mohdm1

	//exec global/ambient.scr mohdm2

	//$world farplane 5000
	//$world farplane_color (.333 .333 .329)

	level waittill spawn
	
wait 5
 local.panzer = spawn models/human/flowerpainting.tik
 local.panzer.origin = ( -82.91 201.41 -43.35 )
 local.panzer.angle = 180
 local.panzer solid
 local.panzer immune bullet
 local.panzer immune fast_bullet
 local.panzer immune bash
 local.panzer immune mg
 local.panzer immune explosion
 local.panzer nodamage

end
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Try

local.panzer.angle = 90
Image
Altusi
Lance Corporal
Posts: 13
Joined: Sat Mar 24, 2007 5:08 pm

Post by Altusi »

jv_map wrote:Try

local.panzer.angle = 90
-yes un think it's work with it, but if what i have to write in my script for rotate in the others angles?

-Oh the command local.panzer.angle = 90 work with the model:
models/human/allied_oss_man_m1.tik
but not with the model:
models/static/flowerpainting.tik
What is going on? i don't understand why the second doesn't worked, because the first work!
Why it do that?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Altusi wrote:-yes un think it's work with it, but if what i have to write in my script for rotate in the others angles?
Try nother number :wink:
-Oh the command local.panzer.angle = 90 work with the model:
models/human/allied_oss_man_m1.tik
but not with the model:
models/static/flowerpainting.tik
What is going on? i don't understand why the second doesn't worked, because the first work!
Why it do that?

Hmm well you shouldn't spawn static models via script anyway, just place them in radiant.
Image
Altusi
Lance Corporal
Posts: 13
Joined: Sat Mar 24, 2007 5:08 pm

Post by Altusi »

jv_map wrote:
Altusi wrote:-yes un think it's work with it, but if what i have to write in my script for rotate in the others angles?
Try nother number :wink:
Yes :wink: , but i mean in others angles like up and down for example.
Because nothing happen when try to put "( 90.12 45.15 40.12 ) in the angle field.

Plus i can see the model move to 90? :shock: Why i can see the movement of my model? (because i need to spawn this model a lot's of time ingame, so the player will see the model flip to 90?...)

Like you say maybe i shoudn't use static model. (maybe static mean... static! :)

And thanks to be here and help me Jv_map!

Al
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

No problemo :) , if you see a visual flip then move the angle command into the spawn line:

local.panzer = spawn models/human/flowerpainting.tik angle 90

To rotate over different axes, use the angles command:

local.panzer = spawn models/human/flowerpainting.tik angles ( 90.12 45.15 40.12 )

or

local.panzer.angles = ( 90.12 45.15 40.12 )
Image
Altusi
Lance Corporal
Posts: 13
Joined: Sat Mar 24, 2007 5:08 pm

Post by Altusi »

jv_map wrote:No problemo :) , if you see a visual flip then move the angle command into the spawn line:

local.panzer = spawn models/human/flowerpainting.tik angle 90

To rotate over different axes, use the angles command:

local.panzer = spawn models/human/flowerpainting.tik angles ( 90.12 45.15 40.12 )

or

local.panzer.angles = ( 90.12 45.15 40.12 )
Thanks for this.
But i am really sorry because i still see the visual flip! (and i am sure to did what you say) I think about an other thing. Is it possible to set the speed of this model? maybe i can set it, so the player will not see the flip, because of the high speed.

Al
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

wait

Post by tltrude »

You have "wait 5" seconds in the script. To make it happen faster, remove that line, or reduce the time "wait .02".
Tom Trude,

Image
Altusi
Lance Corporal
Posts: 13
Joined: Sat Mar 24, 2007 5:08 pm

Post by Altusi »

Hello,

Thanks for your help.
And i find the problem. It's not the wait command. I had to change something in the model file (.tik).
I am not so skill, so i change some things in this file (past some line of other model for try).
And i am not sure that what i changed :(
So sorry to don't explain more.

Just one thing: it's work now without flip rotation!

PS: if i find something i will write here.

Thanks
Post Reply