Box Position, Rotation etc. always 0
#1
I noticed this when I wrote a script that involved placing a Explosion object in a Box's position. Since the Position always shows up as (0.0, 0.0) no matter what, the Explosion will always spawn at that point.

I'm pretty sure this is a fault from Buildism's part and not mine, though if for some reason this code is wrong, tell me so:

Code:
local main = script.Parent --player's body.

function onCollide()
   local e = create("Explosion")
   e.Radius = 6
   e.Force = 10000
   e.Parent = game.World
   e.Position = main.Position --places it at Vec2D(0, 0), I presume
   --main.Transparency = 1 --doesn't work w/texture
   main.Parent.Health = 0
   main:remove()
end

also part transparency should affect any Texture inside it, imo
Reply
#2
Your problem is trying to adjust the position after putting it in the world. Swap those two lines around and it should work fine.

Also, about that transparency thing: characters are drawn in a special way. The body is already fully transparent -- it's just the physics part of the player, not the graphics part.
Reply
#3
Why can't I change an object's Position after putting it in the World, then? That doesn't make much sense to me, either.

I always see the Position as (0,0) in the object's properties, too, should've explained that clearer.
Reply
#4
I see it just fine, so something must be wrong on your end then. And as far as I can tell it's just a bug with explosions -- part positions should change normally.
Reply
#5
Client-side bug or not, it's definitely something that should be fixed. Can get annoying at times ;P

I don't seem to get the Explosion positioning bug, I edited my script as you mentioned, and used the "Events" tab of the object properties, and it works perfectly now.
Reply
#6
An explosion is an effect, not a physical part. The position is set when you add it to the world and can't be changed.

It's always a good idea to set all of the properties you can before adding something to the world, since it's more efficient and reduces your chance of running into weird bugs.
Reply
#7
(09-03-2012, 02:04 AM)_Jacob Wrote: An explosion is an effect, not a physical part. The position is set when you add it to the world and can't be changed.

It's always a good idea to set all of the properties you can before adding something to the world, since it's more efficient and reduces your chance of running into weird bugs.
Oh lol, didn't ever consider the possibility of it not behaving like a physical part. Thanks for clearing that up c:

EDIT: ...but I'm still getting the Position = (0,0) glitch. It's particularly annoying now that I'm making a Tool that fires projectiles. >.> nvm it's just me sucking at scripting
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)