Welcome Back! Please login below. If you are not yet a member, why not register? Enjoy!
We have now opened a new Build server! IP: 188.165.193.102:27016

    Setting the mass of an object

    Share
    avatar
    chargers5583
    Elite Member
    Elite Member

    Number of posts : 473
    Age : 22
    Location : San Diego
    In-Game Name : [NBUټ] (*BS*) Red Baron

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    2 / 102 / 10

    Registration date : 2009-06-30
    Points : 577
    Reputation : 6

    Setting the mass of an object

    Post by chargers5583 on Sun Nov 08, 2009 4:10 am

    Is there a way to do it?

    Example: ent.SetMass(10)

    If so tell me if that is correct and if it isn't the right way could you please use it in an example...
    avatar
    jakegadget
    VIP Member
    VIP Member

    Number of posts : 68
    Age : 25
    Location : california
    In-Game Name : Companion Cube |STZ|

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    0 / 100 / 10

    Registration date : 2009-07-04
    Points : 104
    Reputation : 6

    Re: Setting the mass of an object

    Post by jakegadget on Sun Nov 08, 2009 11:40 pm

    http://wiki.garrysmod.com/?title=PhysObj.SetMass

    So, ply:SetMass(1)
    self.Entity:SetMass(250)
    avatar
    chargers5583
    Elite Member
    Elite Member

    Number of posts : 473
    Age : 22
    Location : San Diego
    In-Game Name : [NBUټ] (*BS*) Red Baron

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    2 / 102 / 10

    Registration date : 2009-06-30
    Points : 577
    Reputation : 6

    Re: Setting the mass of an object

    Post by chargers5583 on Mon Nov 09, 2009 12:49 am

    jakegadget wrote:http://wiki.garrysmod.com/?title=PhysObj.SetMass

    So, ply:SetMass(1)
    self.Entity:SetMass(250)

    Thanks but don't need it anymore but I could use some help. My weapon won't show up when I aded a new thing to the code and when I took it out It still wont Sad

    me wrote: local prop = ents.Create("prop_physics")
    prop:SetModel (Model)
    prop:SetPos (self.Owner:GetPos()+(self.Owner:GetAimVector() * 48 + Vector(0,-100,100)
    prop:SetAngles (self.Owner:EyeAngles())
    prop:Spawn()
    cleanup.Add (self.Owner, "props", prop)
    undo.Create("prop")
    undo.AddEntity(prop)
    undo.SetPlayer(self.Owner)
    undo.Finish()
    local phys = prop:GetPhysicsObject()
    local shot_length = tr.HitPos:Length()
    phys:ApplyForceCenter (self.Owner:GetAimVector() * 0)
    phys:AddAngleVelocity(Angle)
    end
    end
    end

    prop:SetPos (self.Owner:GetPos()+(self.Owner:GetAimVector() * 48 + Vector(0,-100,100) is the line Razz
    avatar
    jakegadget
    VIP Member
    VIP Member

    Number of posts : 68
    Age : 25
    Location : california
    In-Game Name : Companion Cube |STZ|

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    0 / 100 / 10

    Registration date : 2009-07-04
    Points : 104
    Reputation : 6

    Re: Setting the mass of an object

    Post by jakegadget on Tue Nov 10, 2009 2:09 am

    Vector(0,-100,100)

    I'm not sure what you are trying to do here. Usually using the x or y in the vector can mess you up though, since its relative to the world. Tell me your idea and I can tell you a better way.
    avatar
    chargers5583
    Elite Member
    Elite Member

    Number of posts : 473
    Age : 22
    Location : San Diego
    In-Game Name : [NBUټ] (*BS*) Red Baron

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    2 / 102 / 10

    Registration date : 2009-06-30
    Points : 577
    Reputation : 6

    Re: Setting the mass of an object

    Post by chargers5583 on Tue Nov 10, 2009 3:04 am

    jakegadget wrote:Vector(0,-100,100)

    I'm not sure what you are trying to do here. Usually using the x or y in the vector can mess you up though, since its relative to the world. Tell me your idea and I can tell you a better way.

    I am trying to set the prop in front of me ALWAYS no matter where I turn, so the Aimvector is kinda like how left or right it is I believe. If you have a better way I would like to know because this ain't workin for me Sad

    prop:SetPos (self.Owner:GetPos()+(self.Owner:GetAimVector() * 48 + Vector(0,-100,100) is the line
    avatar
    jakegadget
    VIP Member
    VIP Member

    Number of posts : 68
    Age : 25
    Location : california
    In-Game Name : Companion Cube |STZ|

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    0 / 100 / 10

    Registration date : 2009-07-04
    Points : 104
    Reputation : 6

    Re: Setting the mass of an object

    Post by jakegadget on Wed Nov 11, 2009 2:18 am

    prop:SetPos(self.Owner:GetForward())

    You should be able to multiply the return of GetForward() by a number to increase how far forward you put it, eg:

    prop:SetPos(self.Owner:GetForward() * 15)
    avatar
    chargers5583
    Elite Member
    Elite Member

    Number of posts : 473
    Age : 22
    Location : San Diego
    In-Game Name : [NBUټ] (*BS*) Red Baron

    Credits Credits :
    0 / 1000 / 100

    Warnings! Warnings! :
    2 / 102 / 10

    Registration date : 2009-06-30
    Points : 577
    Reputation : 6

    Re: Setting the mass of an object

    Post by chargers5583 on Wed Nov 11, 2009 2:47 am

    jakegadget wrote:prop:SetPos(self.Owner:GetForward())

    You should be able to multiply the return of GetForward() by a number to increase how far forward you put it, eg:

    prop:SetPos(self.Owner:GetForward() * 15)

    Thank you very much! I will try it out later!

    Edit: It didn't work Sad it spawns in the center of the map Sad

    Sponsored content

    Re: Setting the mass of an object

    Post by Sponsored content


      Current date/time is Wed Nov 14, 2018 4:36 am