More flexible model rotating

Moderator: Graf Zahl

Locked
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

More flexible model rotating

Post by Enjay »

The rotating command for modeldefs is cool. It can be used for far more than just making a pickup spin. eg The electrical ball thing from Strife with the green ball rotating inside 3 columns can be done far more smoothly with a rotating model for the ball and a second static one for the columns than with an animated model - even with additional frames and interpolation.

So I'd like to see more rotation options if possible. It's be nice to be able to specify rotation speed and direction. Perhaps both could be achieved with a single parameter. A number for speed or rotation (or time taken for 1 rotation if that's better). If the number is +ve, the current default direction is used. If it's -ve then it rotates in the reverse direction.

Any chance?
User avatar
ChupaReaper
Posts: 202
Joined: Fri Jun 15, 2007 16:35
Location: England
Contact:

Post by ChupaReaper »

What about a speed value for each direction (rotate x,y,z)? 255 being max, 0 not at all and -255 reverse?
User avatar
TheDarkArchon
Posts: 1000
Joined: Wed Jul 06, 2005 11:58
Location: What's that fucking smell
Contact:

Post by TheDarkArchon »

Or maybe something like this: (rotate,x,y,z), rotate being the angle in degrees and x, y and z being multipliers of the angle.

(This is in no way inspired by glRotate. Nu-uh)
User avatar
Torr Samaho
Developer
Developer
Posts: 160
Joined: Fri Apr 13, 2007 8:26
Location: Germany
Contact:

Post by Torr Samaho »

I like the idea and I already partially implemented it :). But I think you also need to be able to specify the center of the rotation, otherwise the model can be rotated into the ground. Opinions?
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Post by Enjay »

Hmmm... yes I see what you mean by that. A common position for the origin of a model that stands on the ground is in the middle of the object, viewed from above, but at ground level. Rotating that anything other than horizontally would push it into the ground. But placing the origin higher in the model would mean the object sits in the ground anyway.

For a simple, static decoration, I would make the decoration have the +nogravity flag and then place the thing itself a suitable number of units above the floor. However, that would mean that it couldn't be used on a moving floor, for example. And then what if I wanted to have something apparently rolling along the ground...

So, yes, I think some sort of Z offset built into the model definition would be good. I think it would work best to have a number that specified a Z offset relative to the model's origin purely for rotating purposes. It would need to be possible to enter the number as either +ve ore -ve (takes care of hanging objects and other odd situations). A system like that would leave all the normal model creation and placing stuff as it is at present but allow things to be tailored for rotating via the modeldef lump.
User avatar
Torr Samaho
Developer
Developer
Posts: 160
Joined: Fri Apr 13, 2007 8:26
Location: Germany
Contact:

Post by Torr Samaho »

I added zoffset support to MODELDEF some time ago, it's definitely in GZDoom 1.0.29. Just add a "zoffset float" line to your MODELDEF.

And I just finished a first implementation of the customizable rotation:

Code: Select all

- Made the model rotation customizable:
	rotation-speed  float: Specify the speed of the rotation
	rotation-vector float float float: Specify the x, y and z component of the vector of the rotation
	rotation-center float float float: Specify the x, y and z coordinate of the center of the rotation
	(Defining rotation initializes the speed to 1, the vector to (0,1,0) and the center to (0,0,0))
With this, you should be able to achieve the rotation you described.
User avatar
ZardoZ
Posts: 12
Joined: Tue Dec 25, 2007 23:37

Post by ZardoZ »

My small suggestion :
Displace the object over the ground or object origin cords. This will allow to fix some problems like half model are under the floor, etc...
User avatar
Torr Samaho
Developer
Developer
Posts: 160
Joined: Fri Apr 13, 2007 8:26
Location: Germany
Contact:

Post by Torr Samaho »

This is already possible with zoffset.
Locked

Return to “Closed Feature Suggestions”