Welcome Back! Please login below. If you are not yet a member, why not register? Enjoy!

Join the forum, it's quick and easy

Welcome Back! Please login below. If you are not yet a member, why not register? Enjoy!

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Setting the mass of an object 31We have now opened a new Build server! IP: 188.165.193.102:27016Setting the mass of an object 31

2 posters

    Setting the mass of an object

    chargers5583
    chargers5583
    Elite Member
    Elite Member


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue2 / 102 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Setting the mass of an object

    Post by chargers5583 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...
    jakegadget
    jakegadget
    VIP Member
    VIP Member


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue0 / 100 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Re: Setting the mass of an object

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

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

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


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue2 / 102 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Re: Setting the mass of an object

    Post by chargers5583 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
    jakegadget
    jakegadget
    VIP Member
    VIP Member


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue0 / 100 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Re: Setting the mass of an object

    Post by jakegadget 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.
    chargers5583
    chargers5583
    Elite Member
    Elite Member


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue2 / 102 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Re: Setting the mass of an object

    Post by chargers5583 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
    jakegadget
    jakegadget
    VIP Member
    VIP Member


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue0 / 100 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Re: Setting the mass of an object

    Post by jakegadget 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)
    chargers5583
    chargers5583
    Elite Member
    Elite Member


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

    Credits Credits :
    Setting the mass of an object Left_bar_bleue0 / 1000 / 100Setting the mass of an object Right_bar_bleue

    Warnings! Warnings! :
    Setting the mass of an object Left_bar_bleue2 / 102 / 10Setting the mass of an object Right_bar_bleue

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

    Setting the mass of an object Empty Re: Setting the mass of an object

    Post by chargers5583 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


    Setting the mass of an object Empty Re: Setting the mass of an object

    Post by Sponsored content

      Similar topics

      -

      Current date/time is Fri Apr 26, 2024 6:59 pm