how to add a model to an entity (newbie)

Having issues not related to a specific Sandbox game mode? Get help here!
Please also read the rules for support when posting support requests.
Failure to comply with the forum rules may result in your topic being locked without resolution.
Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: how to add a model to an entity (newbie)

Post by Hirato »

Also, the path for all models is ALWAYS a DIRECTORY relative to packages/models/
Is your model really inside packages/models/brick/tris/ ? Your message seems to imply you should just be using "brick" not "brick/tris"
Also, modellers tend to use much bigger units than the engine, so you'll probably want to scale it up, as opposed to down to 75%
This is not a url, clicking it is pointless
doctorface
Member
Member
Posts: 17
Joined: April 4th, 2012, 2:44 am
Name: shanan

Re: how to add a model to an entity (newbie)

Post by doctorface »

yeah its an obj file so its called tris.obj its in a folder called "brick" which is under the models folder, with that file there is also a obj.cfg file and a skin.bmp for my texture.( i can change the model name if its causing issues)

i can import my obj easily so it is working (i use the command /mmodel brick) then its in my model index ingame.

what i want to be able to do is to push my "brick" in game by walking upto it with my character, i was told to use the box entity but it doesn't seem to work

i am using FPS which i prefer but if it has to be RPG i'll change over as ive just started but am trying to make a FPS eventually....
doctorface
Member
Member
Posts: 17
Joined: April 4th, 2012, 2:44 am
Name: shanan

Re: how to add a model to an entity (newbie)

Post by doctorface »

sorry bro

no my model is in packages/models/brick/

i agree with the scalling but i can easily change that i basically just copied and pasted some code as suggested, the obj.cfg was actaully blank before i was getting some help on this forum, as i worked out the correct model scale/size etc with my modeling program. and ill play around with that later unless its neccessary to have a fixed sized for the coding to make the object "pushable"?

sorry for not being clear and thanks for helping
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: how to add a model to an entity (newbie)

Post by Sircameron »

Ok well i hate to tell you this, but i havent even touched the FPS mode so i have no clue.. I don't wanna make you switch modes if you're really set on making a fps.. What i can help you with is the "obj.cfg" file so that your model loads correctly so copy the following into the "obj.cfg" file

Code: Select all

objload tris.obj
objskin * tris.jpg
mdlscale 100

Note the fact at you have to change your skin file to a ".jpg" file because i couldnt use a ".bmp" file when i tried it.. And the name of your model skin must be "tris.jpg" (or you can change "tris" to the file name of your skin)... This will make the "mmodel" work properly and allow you to add your model to your map.. As for moving it.. Thats an answer that i dont have.. Goodluck! Hope this helps you out
doctorface
Member
Member
Posts: 17
Joined: April 4th, 2012, 2:44 am
Name: shanan

Re: how to add a model to an entity (newbie)

Post by doctorface »

thanks for all your help
purhaps i was under the wrong impression thinking that "box" entity allows you to push objects around and "barrel" entity is the same but needs an explosion to move the object

hopefully Hirato can help further, if its possible

thanks again
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: how to add a model to an entity (newbie)

Post by Sircameron »

Ok so i may have figured it out! You need to edit the "default_map_models.cfg" though in the (pas/data) folder, and at the very bottom of the list add

Code: Select all

mmodel "brick/tris"
this will add your model to the list automatically.. Then you need to type "newent box 164 25" in the console
(164) = the 164th model on the list in the default_map_model.cfg
(25) = the weight of the box the heavier the harder it is to move.. This should work in the fps mode
doctorface
Member
Member
Posts: 17
Joined: April 4th, 2012, 2:44 am
Name: shanan

Re: how to add a model to an entity (newbie)

Post by doctorface »

worked sweet made a "box" entity with my model yay!!!

only problem i can't push it also it sinks half into the ground, literally to half way mark not sure if thats a model issue... probably as if i use another model it doesn't sink, but also if i use other models i can't push either

also tried using barrel entity which didn't work (didn't think it would as it needs an explosion apparently)

good work though deffinately learnt how to add a model to an entity, thanks heaps

any idea what to do next?
User avatar
Sircameron
Member
Member
Posts: 62
Joined: March 6th, 2012, 9:13 pm
Name: Cameron
Location: Indiana

Re: how to add a model to an entity (newbie)

Post by Sircameron »

Try making it lighter by changing the (25) to a lower number like (5) to see if you can move it.. Im almost certain the sinking is cause by the model.. If you move it up higher on its z-axis you should be fine (in your 3d modelling program not in game)
doctorface
Member
Member
Posts: 17
Joined: April 4th, 2012, 2:44 am
Name: shanan

Re: how to add a model to an entity (newbie)

Post by doctorface »

yeah sinking is deffinately the model, so i tried a different model for now just to see if it will work

tried using the weight value of 1 and .1, still don't work must need something else just to make it moveable by me pushing it?

weird since other entities ive tried work as they should without extra coding, thats why i think ive misunderstood the wiki and maybe "box" doesn't move by running into it maybe it only moves with another force hitting it
doctorface
Member
Member
Posts: 17
Joined: April 4th, 2012, 2:44 am
Name: shanan

Re: how to add a model to an entity (newbie)

Post by doctorface »

i just read this

viewtopic.php?f=15&t=1599

seems like you have to shoot something to make it move or did have to in an old release

might need specific scripting i suppose
Locked