Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Newbie Questions
by AndrewAMD. 12/04/23 11:14
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (TipmyPip, Quad, alibaba, izorro), 545 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 4 1 2 3 4
Re: How to attach models to models [Re: EvilSOB] #218693
07/29/08 22:30
07/29/08 22:30
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline OP
Serious User

Joined: Jan 2008
Posts: 1,580
no problem, i have assigned the correct action in wed , (test.wmb) and built it . It loads fine, except with the error empty pointer ,


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: How to attach models to models [Re: Blade280891] #218703
07/30/08 01:07
07/30/08 01:07
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Redone it in REAL SED this time and I see where I was going wrong.
One simple typo was corrupting multple structures as best as I can figure.

Heres a new, fully tested and tidier version. Let me know how you go.

Code:
#include <acknex.h>;
#include <default.c>;
//
//
//
ENTITY*	character;
action	SetupPlayer()   {   character = me;   }
//
//
function Helmet()
{
   VECTOR* ArmorPos = { x=0; y=0; z=0; }
   while(1)
   {
      if(character!=0)
      {
         //Position to match Bone	
         vec_set(me.x,vec_for_bone(ArmorPos,character,"head"));
         //Rotate to match Bone	
         vec_set(me.pan,ang_for_bone(ArmorPos,character,"head"));
      }
      else
      {
         ent_remove(me);	
         break;
      }
      wait(1);
   }
}
//
//
//
//
//
//
function main()
{
   level_load("test.wmb");
   wait(2);
   //
   //		
   wait(-7);   //wait 7 seconds before creating hero_proxy_head 
               //  This wait is optional - its only here so you can see the creation "happen"
   ent_create("hero_proxy_head.mdl",nullvector,Helmet);
   //	
}
//
//
//


The reason the code calls and keeps running the "Helmet" function is because
you cant actually "attach" one entity to another (as far as I know so far, Im pretty noob myself).
So you create the sub-entity, and leave the "Helmet" function running so it keeps updating the
position and rotation of the sub-object to match the parent entity.
You will need to create a similar function to "Helmet" FOR EACH armor position
(ie head, leftarm, rightarm, etc.) unless you make one big function
that manages them all, but I dont know if that would be time-efficient.

Any questions feel free...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: How to attach models to models [Re: EvilSOB] #218752
07/30/08 11:01
07/30/08 11:01
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline OP
Serious User

Joined: Jan 2008
Posts: 1,580
omg, thanks this one works , i will need to tweak it for my neads a bit , but it puts the helmet on the characters head posistion. A few problems i am going to encounter, for example when he puts the helmet on (attachs it) it will need to be on facing the same way as the player. any ideas? Would i need to detect what way the player is facing?


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: How to attach models to models [Re: Blade280891] #218827
07/30/08 20:37
07/30/08 20:37
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline OP
Serious User

Joined: Jan 2008
Posts: 1,580
With this code the head never faces the correct way , always to the right, and if i try something like
my.pan your.pan

it faces the left.
Any one know why?


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: How to attach models to models [Re: Blade280891] #218851
07/31/08 02:16
07/31/08 02:16
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Yeah, its crude, but I meant it for tutorial purposes rather than a plug-in. grin

I had no problem with the add-on models rotation so you should compare
both models in MED, and be sure they are 'facing' the same way there?

I had the same problem at first cause the helmets origin-rotation in
MED was a different rotation to the Character model.

Another point to remember, the add-on model's XYZ-origin in MED
is going to be placed at the Bone HINGE location of the character
model when attached. eg upperarm bone hinge is at the shoulder, so
the armor needs its XYZ-origin there, not centered. Get what I mean?

There ARE other things your final function will probably need to do,
but I havent gone into then cause this is your project, and I have my
own projects (and associated problems) to work on.
Remember Im a Noob too. grin

Other things Ive thought of that this function needs to manage:-
1) Storing to a global pointer so Armor parts can be removed/replaced/modified individually.
2) Rescaling of add-on model to match scaling of character model if there is a difference

Im sure there was more but I cant remember them now...
Please keep us posted on how you go.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: How to attach models to models [Re: EvilSOB] #218853
07/31/08 03:06
07/31/08 03:06
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline OP
Serious User

Joined: Jan 2008
Posts: 1,580
Ok i understand and thanks for all the help. Our head coder wasnt aware of how to perform this aswell , but now he has all so learnt from this code he is now making it better by adding animation etc. If we come across any more problems i will post here.


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: How to attach models to models [Re: Quad] #218922
07/31/08 11:34
07/31/08 11:34
Joined: Dec 2007
Posts: 69
Kasey_Dee Offline
Junior Member
Kasey_Dee  Offline
Junior Member

Joined: Dec 2007
Posts: 69
The big issue with something like the mesh shown on a previous post is clipping.

Re: How to attach models to models [Re: Kasey_Dee] #218931
07/31/08 12:38
07/31/08 12:38
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline OP
Serious User
Blade280891  Offline OP
Serious User

Joined: Jan 2008
Posts: 1,580
me? feel free, the one we finish with will be alot of different


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Page 4 of 4 1 2 3 4

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1