Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / A Scale Object Without Percentages

Author
Message
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 31st Aug 2006 21:28 Edited at: 1st Sep 2006 20:52
I don't know about everybody else, but I don't like the SCALE OBJECT command and the way that it uses percentages! So, I decided to make a SCALE OBJECT function that does not use percentages, but normal sizes like the SIZE SPRITE command does. The function itself uses Scale Object, but you don't need to write it. Here it is. It's called SizeObject:



The first parameter is the object number that you want to resize.
The second parameter is the X size.
The third parameter is the Y size.
The fourth parameter is the Z size.

The reason why all of the variables have a SQ_ in front of them is just to make those variables stand out. In DBPro, somebody may have already made X# a global variable for another purpose, as it is a common name. However, SQ_X# isn't a very common name. Why SQ? It sounds like Sixty Squares

Here's a simple example to toy with:




and here the function is again in 1 line lol:


Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 31st Aug 2006 22:13
youve beaten me to it

FPSC-Toolkit in the make.Progress log:
FPSC-Segments 35%---FPSC-Entity 's 0%---FPSC-Signs 0%
FPSC-Decals 0%---FPSC Characters 0%
Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 1st Sep 2006 07:45
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 1st Sep 2006 15:46 Edited at: 1st Sep 2006 15:46
Thanks.
Lol looks like lots of people don't like scale object.

Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 1st Sep 2006 16:45
i hate it

stupid percents...i always forget its in percents,not in Coordinates

FPSC-Toolkit in the make.Progress log:
FPSC-Segments 35%---FPSC-Entity 's 0%---FPSC-Signs 0%
FPSC-Decals 0%---FPSC Characters 0%
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Sep 2006 19:55
Too much math!

Make your objects initial size 100. Then any number you scale it by is technically the exact size it's going to be. Of course, this works easier in practice with primitives, not external media.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 1st Sep 2006 20:32
Yes it's more simple with primitives. Just the external media (i.e. those TINY DarkMatter models) are the reason for this function. I hate scaling those!

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Sep 2006 17:45
I know what you mean. When I make models in Wings, they always appear way too small. This functions seems usefull. Well done

Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 7th Sep 2006 18:05
Mind if i use it in a Function pack?

im just working on it.it will be free and you will be in the credits if its used.

(""(o_o)(""
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 7th Sep 2006 23:26
I don't mind at all, thanks for including me!

Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 8th Sep 2006 07:53
OK!

*Makes Creditlist*

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Sep 2006 16:53
I think a tweaked version would be handy too. Like using that same technique, but only go by the Y scale, so you might use it to scale a character to certain height, but you'd want the sides to be scaled uniformally. Something like this (untested):

function HeightObject(SQ_OBject,SQ_y#)

SQ_sy#=Object size y(SQ_Object)
SQ#=100*(SQ_y# / SQ_sy#)

Scale OBject SQ_OBject,SQ#,SQ#,SQ#
endfunction

''Stick that in your text and scroll it!.''
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 9th Sep 2006 01:19 Edited at: 9th Sep 2006 01:19
Good idea, but to do that you could:

SizeObject( 1, Object Size x(1,1) , HEIGHT , Object size z(1,1) )

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 10th Sep 2006 17:19
Here's what I'm doing. It's based on both of your code...



That lets you define the Y Height as DBP units, which is very handy. However, I don't always want the X and Z sizes to be the same, but I don't want to have to input their sizes. So, you just put in their percentage which is relative to the height of the model.


Come see the WIP!
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 10th Sep 2006 18:29
Ok. But I have 1 question... what is Calculate Object Bounds??? My guess is that it recalculates collision after scaling, but the command doesn't highlight in my IDE. Is it undocumented or something?

Oh, and this was a DBC+DBPro function

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 11th Sep 2006 13:10
Yeah, it's not always necessary, but it applies more to animated models. It never hurts to do it.

It's an undocumented DBP command. 5.9, I think?


Come see the WIP!

Login to post a reply

Server time is: 2024-11-23 03:27:52
Your offset time is: 2024-11-23 03:27:52