Main Search
Delta Corp Forum Index
 
 
FAQ Members Groups Profile Private Messages

Important Notice: We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024. If you wish to migrate to our paid hosting service, please contact [email protected].
"Script" Command/Function Request: Finding the rea

 
Post new topic   Reply to topic    Delta Corp Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
chess123mate
Beginner Poster


Joined: 06 Feb 2008
Posts: 40
Location: Canada

PostPosted: Mon Jul 07, 2008 11:12 pm    Post subject: "Script" Command/Function Request: Finding the rea Reply with quote

Name: Command/Function for finding the true size of a brick in World coordinates

Brief Description: I need to find the real size of a brick, so that if it's rotated, the "real" size changes accordingly. The simplest example is if a 2x1x4 brick is rotated 90 degrees (left/right, doesn't matter), then it is now a 4x1x2 brick. Of course, this function/command needs to have the ability to take absolutely any angle, including vertical angles.

Wiki link: http://wiki.roblox.com/index.php?title=Scripting#CFrame
Note that some of the commands there, though I tried to use them, didn't seem to exist... [or didn't do anything significant]

Place It'll be used in: Antz Warz, account "chess123mate2", as an ERRC Project. I need it so that the builders of the project don't have to make all the bricks non-angled, lol... the ants need to know how to get around an object when they hit it, or if they want to get to it.

Roblox Forums link: http://www.roblox.com/Forum/ShowPost.aspx?PostID=1705058

Thanks for any help you can give me. I hoped there was an easier solution than trig to do this, but I'm unsure. If anyone knows the trig, I'd greatly appreciate showing me how to use it.

chess123mate
Back to top
View user's profile Send private message Yahoo Messenger
kiddietron
Site Admin


Joined: 06 Feb 2008
Posts: 797
Location: On Roblox

PostPosted: Mon Jul 07, 2008 11:56 pm    Post subject: Reply with quote

This is difficult but I think I've seen something like this. If I find something out I'll get back to you.
_________________
�Kiddietron
�Phailing at making a signature

Free Money here just sign up and click away.
http://bux.to/?r=kiddietron

Spam is for noobs.

Back to top
View user's profile Send private message Send e-mail AIM Address
Anaminus
Beginner Poster


Joined: 08 Feb 2008
Posts: 17
Location: Location: Location: Location: Location: Location:

PostPosted: Tue Jul 08, 2008 8:33 pm    Post subject: Reply with quote

I don't quite know what you want, but I think I know something that could work. Try this out:


Code:
part = workspace.Part
o = part.CFrame

e = true
part.Changed:connect(function(p)
   if p == "CFrame" then
      if not e then return end
      e = false
      local v = part.CFrame:vectorToWorldSpace(part.Size)
      part.Size = Vector3.new(math.abs(v.x),math.abs(v.y),math.abs(v.z))
      part.CFrame = o
      e = true
   end
end)


It's not in any function form, but maybe you can get something from it. I don't really know how it works, but I remember seeing 'rotation' and 'Vector3' in the CFrame article. After giving a few tries at the vectorToWorldSpace function, it apparently worked. Razz


?-Anaminus-?
_________________
?-Anaminus-?

^^You're probably seeing this twice because I typed in my signature >_<
Back to top
View user's profile Send private message
chess123mate
Beginner Poster


Joined: 06 Feb 2008
Posts: 40
Location: Canada

PostPosted: Tue Jul 08, 2008 10:20 pm    Post subject: Reply with quote

Wow... I'm not sure that works, but it sure is interesting Smile
The wiki didn't say how to use the functions like vectorToWorldSpace, it just kind of said "there, now you figure it out" Razz
Unfortunately, I can't check it out right now (time + on a bad computer), but I will as soon as I can Smile

That script honestly is confusing Smile It seems to re-adjust it's size, if I understand it correctly, based on it's angle and thus it's WorldSpace coordinates. Cool!

EDIT: Yes, thanks! Very Happy This is exactly what I need! The thing about the wiki is it didn't tell you what the parameters needed to be. Someone should really rewrite those.

The command I needed was:
size=part.CFrame:vectorToWorldSpace(part.Size)
[and then optionally]
size=Vector3.new(math.abs(size.x), math.abs(size.y), math.abs(size.z))

It does the calculations I was looking for. If you rotate a brick, obviously the brick's size stays the same, but if you looked at it from the World's point of view (without angle), it would look like a diamond-like shape with a completely different size. I don't know if that helped describe this any.
Thanks again,
chess123mate
Back to top
View user's profile Send private message Yahoo Messenger
kiddietron
Site Admin


Joined: 06 Feb 2008
Posts: 797
Location: On Roblox

PostPosted: Tue Jul 08, 2008 11:04 pm    Post subject: Reply with quote

Wow, sorry I couldn't help but this looks like a promising function. Better than doing all the trig. Smile
_________________
�Kiddietron
�Phailing at making a signature

Free Money here just sign up and click away.
http://bux.to/?r=kiddietron

Spam is for noobs.

Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic    Delta Corp Forum Index -> Script Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Back to Top              
Jenova Template © digital-delusion.com
Powered by phpBB © 2001, 2002 phpBB Group



For Support - http://forums.BizHat.com

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!