Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 996 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
vertex attaching, 2 functions #137988
06/25/07 15:15
06/25/07 15:15
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
required for both codes:
Code:

entity* ent1;
entity* ent2;



first code:
Code:

function attach_to_vertex(e1, e2, attachvertex)
{
var attach;
var attach_pos;
var roll_pos;
ent1 = e1;
ent2 = e2;
vec_for_vertex(attach,ent2,attachvertex);
vec_set(ent1.x,attach.x);
}



Attach_To_Vertex (entity1, entity2, attachvertex);

Used to attach entity2 to a vertex on entity1

entity1: the entity which will be attached to the first entity.
entity2: the entity which will be "holding" the attached entity.
attachvertex: the vertex of entity2 to attach entity1 to

Code:

function pan_to_vertex(e1, e2, facevertex)
{
var attach;
var attach_pos;
var roll_pos;
ent1 = e1;
ent2 = e2;
vec_for_vertex(attach_pos.x,ent2,facevertex); //vertice between thumb and pointer finger
vec_set(attach.x,ent1.x);
vec_diff(attach,attach_pos,attach);
vec_to_angle(roll_pos.pan,attach);
vec_set(my.pan,roll_pos.pan);
}



Pan_To_Vertex(entity1, entity2, facevertex);

used to make entity1 face a vertex on entity2, use with attach_to_vertex for things such as swords, hammers, etc

entity1: the entity which will face the vertex of entity2
entity2: the second entity, which uses a vertex to attach entity1
facevertex: the vertex of entity2 which entity1 will face

these can both be used to v-attach (using an vertex on one entity to attach another another entity to that vertex) like this:

Code:

action sword_model
{
while (me)
{
attach_to_vertex (me, you, 112); //attach the entity to the "hand" vertex
pan_to_vertex (me, you, 113); //make the entity "face" the second vertex
wait(1);
}
}




- aka Manslayer101
Re: vertex attaching, 2 functions [Re: mpdeveloper_B] #137989
06/26/07 09:02
06/26/07 09:02
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
These are nice little functions which show how functions can be used to simplify further coding.
This is a comment of a non_coder (almost) who finally understood the use of the brackets behind the function name!
Thanks for that!

Re: vertex attaching, 2 functions [Re: Pappenheimer] #137990
06/26/07 09:50
06/26/07 09:50
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Indeed a nice explenation, vertex attaching is great to use if used correctly which with your info shouldn't be any
problem

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: vertex attaching, 2 functions [Re: frazzle] #137991
06/26/07 21:31
06/26/07 21:31
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
i tried to make it look as simple as possible, thank you both, i am thinking of releasing a pack of functions like this plus some ai after our video game is done, the ai doesn't use c_scan, but a scan i made up myself, which i think works better than c_scan, and it is used for team based ai (neutral/enemy/friendly) and can support as many "sides" as needed....but this is about the vertex attaching things, thanks to both of you


- aka Manslayer101
Re: vertex attaching, 2 functions [Re: mpdeveloper_B] #137992
10/25/07 19:16
10/25/07 19:16
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
anyone else need these?


- aka Manslayer101
Re: vertex attaching, 2 functions [Re: mpdeveloper_B] #137993
10/25/07 21:19
10/25/07 21:19
Joined: Jan 2006
Posts: 2,157
Connecticut, USA
Blink Offline

Expert
Blink  Offline

Expert

Joined: Jan 2006
Posts: 2,157
Connecticut, USA
i think it would be awesome, i would really appreciate a contribution like this Manslayer.


My Famous Quotes: "Hip hop is like a virus, infecting everyone and everything around it. Every form of media has some way,shape or form, assimilated hip hop into it." It has also mutated into other strains like, trip hop, house, rap, gangster, and conscious forms. Once you are infected with it, its with you for life."
Re: vertex attaching, 2 functions [Re: Blink] #137994
10/26/07 23:07
10/26/07 23:07
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline
Serious User
Nowherebrain  Offline
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Very interested in the AI scanning..I'm tracing(not every frame, but gets slow with many enemies)..


Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/
Re: vertex attaching, 2 functions [Re: Nowherebrain] #137995
10/27/07 04:50
10/27/07 04:50
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
well i was thinking about selling the entire ai system after preva is done, possibly, it's not much but i could sell it for about 5-10 US give or take if i do, i'll include all the functions, like the ones you see above, with the ai...


- aka Manslayer101

Moderated by  adoado, checkbutton, mk_1, Perro 

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