• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

3D Object collision and jump system

Status
Not open for further replies.
3D Object Collision and Jump System 0.4.0.0 Beta


Description

Manual!


This system is created to allow you to create physics like a
3rd person shooter with a 3rd dimension to their physics system.

For example if you want want to make a bridge, without this system
you would only be able to go either under or over and not both.
With this you are able to do both at the same time.

Check out the next tab named "Manual" to find out what you can
do with this system.

Playing the map controls:

Change log:

Known bugs:

Ideas:

Credits:


  1. Use the arrow keys to move
  2. Use the "Q" hotkey to jump

0.4.0.0 Beta

Older change logs

  1. Added new function calls for destroying 3D objects,
    detaching units from the system and changing the units
    coordinates and facing angle
  2. The system has been completely recoded with structs to
    help me with coding the system itself and with this
    the code has been cleaned a lot
  3. Completely removed and scrapped the "Create System Unit"
    function (must use the "Attach System Unit" method now)
  4. Created a manual to help users use the system in their
    maps
  5. Some physics may have been altered for the system

beta .3

beta .2

beta .1

beta 1.0

Main changes:

Minor changes:

  1. Jumping to hit the min z of an object will no longer
    create bugs

  2. Code has started in construction for creating objects
    with polygon figure

  1. Some documentatio has been fixed

  2. Alot of notes(for debuging) have been created(for myself)

  3. Walking off the side of the map creates a fatal error
    instead of heavy lag
  1. This systems code organisation has been changed and
    arranges alot to hopefully make things more
    convenient and easier

  2. Collision objects can be created at anytime in the
    map instead of being limited to being inbuilt to
    one of this systems libraries and only with one
    line of code of a call function instead of using text
    macros

  3. Units are able to be created in any part of code
    within a map, also able to have custom options
    to customise the unit (note: creating a unit inside
    an object or creating an object over the unit would
    probably bug) this change counts as a fix to bug
    no. 6 although adds another known bug

  4. System now works on any size map without code
    modification

  5. Fixed bug no.2 so you can no longer walk on the bottom
    edge of an object and not fall

  6. Fixed bug no.3 enough for it not to be noticaeble,
    with the unit getting stuck while walking along
    an object to another, although bugs with objects
    next to each other with one or more objects being
    stacked on each other still

  7. Fixed bug no.5 so you can not select nor deselect
    units

Main changes:

Minor changes:

  1. For each object that is checked, they get checked
    inside a different function instead of all the code
    being checked inside the loop function. This allows
    to be able to be less likely to hit the OP limit
    and add more object types easily

  2. A location for each instant is created and moved for
    checking height of the ground for the located
    coordinates instead of creating a new one for each
    check. A global could not be created for this as
    once the first instance is over moving it to check
    again does not work

  3. Started my attempt to fix bug #1

  1. Added some documentation to the Movement
    trigger/library (also a little in the
    Object Injection trigger/library), fixed a
    couple of grammar errors in documentation and
    also removed some useless description in the
    instructions documentation

  2. Moved the descriptive logs to a different folder

  3. Removed efficiency notes
Released into the Lab to help me keep motivated on the system
Note that this was meant to be named just beta .0 (but the damage it done)
The official release to the spell section will probably be called 1.0.0.0 Beta




  1. If you try walking under an object you will not be
    stopped(although your are stopped at the min z of the
    object when jumping)
  2. Edge of object clipping occurs
  3. Walking off the edge of the map will make your units
    model disappear. ((Not tested.) Although it is possible
    to create collision objects outside the edge of the map)
  4. Setting a destructables health % to 0 will not remove the
    collision object attached to it
  5. Creating collision objects with any patch of blizzard water
    will create glitching (must have no indication of blizzard water
    around objects with this system for this system to function)
  6. Jumping works half the time when walking down steep cliffs
  7. (Not tested.) If you try and collide with a thin enough object you
    can walk through it
  8. (Not tested.) Removing a 3D collision objects that is attached to
    an destructable before killing the detstructable first will cause bugs
  9. (A possibility.) Some objects do not register or get destroyed properly


  1. Unit Movement with mouse clicks (allow disabling of the Camera
    Arrow structs to be replaced by the normal camera and movement to
    be made by clicks)
  2. Use plains for collition (will help with unnesesary object clipping)
  3. Allow sliding along edges of objects to not stop movment with a
    thickness limit
  4. Make sliding on steep cliffs
  5. Allow usage of triangle like 3D object with z variance
  6. Add extra function calls with hooking to players that use arrow keys
    to move their unit
  7. Hooking to allow units to have unique values for instance their movement
    speed, facing speed and drop and jump rate
  8. Allow a function call that can call once or multiple times when a unit
    enters a 3D objects area and can get the unit that entered
  9. Have a hack for WE that allows placment of 3D collition objects or
    atleast detect the Z value(or fly height like units) of destructables
  10. Allow objects to be stored into variables and moved after creation
  11. When destructables are moved that have objects attached to them move
    them with the destructable and viseversa
  12. Store object data into a variable that allows it to be recreated at a
    coordinate
All to DeathChef for the code and description and what not.
Ahahaha!


Pic no.1:

Pic no.2:

Pic no.3:

Pic no.4:

attachment.php
attachment.php
attachment.php
attachment.php



Content Index:
Importing the system

Attach/Remove a unit (to/from the system):

Attach

Detach Player
Detach Unit
Death Detach
Create/Remove an object (to/from the system):

Create Rectangle Object
Create Rectangle Objects to Destructables

Remove Rectangle Object In Rectangle Area Z
Remove Rectangle Object In Rectangle Area
When Object Destructable Dies

Relocate a Unit:
___



Using the system in your map:
Copy all folders inbetween the Description comment trigger
and the cutoff comment trigger.

Also copy the Interface and Ingame units to use for your map
It it still under construction on this matter though

Use following function calls.
___
Remember to use Jass New Generation Pack or any other software
available for using vJass
___


Attach/Remove a unit (to/from the system):
This system works based around a single unit at a time for each player.
This unit will-

. be able to collide and walk on the objects created for this system
. be given the ability to jump
. have the owning players vision locked to it
. only be able to be ordered to walk by the arrow keys


Once this unit is detached the player and the unit will resume to defualt.


Attach:
SystemUnit.Attach takes unit u, integer UnitInterfaceId, real UnitWidth, real UnitHeight returns nothing

Attaches a pre-existing unit to the system.

If a unit already attached to the system is owned by the same player this
unit will be the new unit attached to this system.


Example of use:
[jass=]call SystemUnit.Attach(GetTriggerUnit(), 'n000', 15, 55)[/code]
Interface Unit = GetTriggerUnit()
Ingame Unit Id = 'n000'
Width (collision) = 14
Height (collision) = 55

Detach Player:
SystemUnit.DetatchPlayer takes player PlayerId returns nothing

Detaches the unit attached to the system owned by the player.

Once this unit is detached the player and the unit will resume to defualt.


Example of use:
[jass=]call SystemUnit.DetatchPlayer(Player(0))[/code]
Owning Player = Player(0)

Detach Unit:
SystemUnit.Detach takes unit u returns nothing

Detaches the unit attached to the system owned by the player.

Once this unit is detached the player and the unit will resume to defualt.


Example of use:
[jass=]call SystemUnit.Detach(GetTriggerUnit())[/code]
Chosen Unit = GetTriggerUnit()


Death Detach:
SystemUnit.- takes - returns -
(There is no function for this)

Detaches any unit attached to this system when that unit dies.

Once this unit is detached the player and the unit will resume to defualt.


Example of use:
Any unit that is attached to this system when dies will detach on its own.
___

Create/Remove an object (to/from the system):
For any unit attached to this system it will be able to collide and walk
on top of the objects created and initialized from the map script.

Note: The objects created in this system represent no art form, other
than collision (the actual objects themselves are invicible).

Create:
RectangleObject.Create takes real MinX, real MaxX, real MinY, real MaxY, real MinZ, real MaxZ returns nothing

Creates an object at the specific map coordinations.


Example of use:
[jass=]call OCJSRegisterRectangle_Create(-690, -600, -490, -400, 390, 530)[/code]
(The tree in the test map)
MinX = -690
NaxX = -600
MinY = -490
MaxY = -400
MinZ = 390
MaxZ = 530

Create Attached to Destructables:
RectangleObject.CreateAttachedToDests takes integer Id, real XSpread, real YSpread, real MinZ, real MaxZ returns nothing

Creates objects with the same set dimention values to all destructables
of the set id.

Caution: The destructables that the object is set to cannot take the
the destructables Z value so make sure all of the destructables under the
same value are on the same Z height.


Example of use:
[jass=]globals
private constant integer LVL1_BARRELS = 'B01A'
endglobals

call RectangleObject.CreateAttachedToDests(LVL1_BARRELS, 32, 32, 390, 460)[/code]
(The first level of dest barrels in the test map)
Destructable Id = LVL1_BARRELS
XWidth = 32
YWidth = 32
MinZ = 390
MaxZ = 460

Remove in Rectangle Area Z:
RectangleObject.RemoveInRectangleAreaZ takes real MinX, real MaxX, real MinY, real MaxY, real MinZ, real MaxZ returns nothing

Removes any object inside the specific map coordinations.


Example of use:
[jass=]call RectangleObject.RemoveInRectangleAreaZ(-690, -600, -490, -400, 390, 530)[/code]
(The tree in the test map)
(Destroys any object that intersects with the object rapped around the tree)
MinX = -690
NaxX = -600
MinY = -490
MaxY = -400
MinZ = 390
MaxZ = 530

Remove in Rectangle Area:
RectangleObject.RemoveInRectangleArea takes real MinX, real MaxX, real MinY, real MaxY returns nothing

Removes any object inside the specific map coordinations.


Example of use:
[jass=]call RectangleObject.RemoveInRectangleArea(-690, -600, -490, -400)[/code]
(The tree in the test map)
(Destroys any object that intersects with the object rapped around the tree
although with no limit of z object coordinate)
MinX = -690
NaxX = -600
MinY = -490
MaxY = -400

On Destructable Death:
RectangleObject.- takes - returns -
(There is no function for this)

When a collition object is attached to a destructable and that destructable
is destroyed, the collition object is destroyed with it.
____


Relocate a unit:
Considering that this system does not allow usage of directly moving any
unit that is attached to it with directly using natives like "SetUnitX"
or "SetUnitPosition", change the units facing angle or FlyHeight, custom
functions have been made to bypass this limitation.

Using these functions should be self explanitry. Just attach the unit to
the function call and any values that you are setting for that unit.

Make sure to "SystemUnit." before the function name so that it is valid to run.


Functions list:
SystemUnit.SetXYZFacing takes unit u, real x, real y, real z, real facing returns nothing

SystemUnit.SetXYFlyHeightFacing takes unit u, real x, real y, real z, real facing returns nothing

SystemUnit.SetXYZ takes unit u, real x, real y, real z returns nothing

SystemUnit.SetXYFlyHeight takes unit u, real x, real y, real z returns nothing

SystemUnit.SetXYFacing takes unit u, real x, real y, real facing returns nothing

SystemUnit.SetXY takes unit u, real x, real y returns nothing

SystemUnit.SetFacing takes unit u, real facing returns nothing

SystemUnit.SetX takes unit u, real x returns nothing

SystemUnit.SetY takes unit u, real y returns nothing

SystemUnit.SetZ takes unit u, real z returns nothing

SystemUnit.SetFlyHeight takes unit u, real z returns nothing
____








3D OCJS 0.4.0.0 Beta
(53.2 KB)
 
Last edited:
Level 16
Joined
Aug 7, 2009
Messages
1,406
The unit doesn't, but the dummy unit that's initially selected does.

Don't spam locations, BTW. Use a global one combined with MoveLocation. And use a safety check in the movement function because it sure as hell freezes once you attempt to move out of the map.
 
Haha, this is awesome. This could be wonderful for multi-floor systems. I'm surprised you got it working so well.

Although, in the test map the unit doesn't have the jump spell (at least for me).

Known bugs:
5. If you try to select your unit you will not be able to jump

Thanks for the appraisal btw. ^^

Don't spam locations, BTW. Use a global one combined with MoveLocation. And use a safety check in the movement function because it sure as hell freezes once you attempt to move out of the map.

Didn't think of that before.
Guess I'll implement it then if it actually is better.

And yeh stopping the unit from lagging when you go to the edge of the map is one of the many things to do on this system.

___

In the next version I'll also try and fish out any grammar errors. Pretty much all the documentation was done on the night of the release.
 
Updated.

Updates: beta 1.0 -> beta .1

Main changes:

Minor changes:


  1. For each object that is checked, they get checked
    inside a different function instead of all the code
    being checked inside the loop function. This allows
    to be able to be less likely to hit the OP limit
    and add more object types easily

  2. A location for each instant is created and moved for
    checking height of the ground for the located
    coordinates instead of creating a new one for each
    check. A global could not be created for this as
    once the first instance is over moving it to check
    again does not work

  3. Started my attempt to fix bug #1

  1. Added some documentation to the Movement
    trigger/library (also a little in the
    Object Injection trigger/library), fixed a
    couple of grammar errors in documentation and
    also removed some useless description in the
    instructions documentation

  2. Moved the descriptive logs to a different folder

  3. Removed efficiency notes
 
Nope it doesn't support spherical objects, as off yet.

This sort of hinted that there will be more object types that can may be possible to be made in future updates.
  1. For each object that is checked, they get checked
    inside a different function instead of all the code
    being checked inside the loop function. This allows
    to be able to be less likely to hit the OP limit
    and add more object types easily

This system is still in a somewhat early development and is why it's still in this section ("The Lab").

I might add a "wish list" and a "things in next version" category in the description somewhere sometime soon.
 
Updated

There is quite alot of code and libraries/triggers re arranged in this new version.

Check out the updates for details!

  1. This systems code organisation has been changed and
    arranges alot to hopefully make things more
    convenient and easier

  2. Collision objects can be created at anytime in the
    map instead of being limited to being inbuilt to
    one of this systems libraries and only with one
    line of code of a call function instead of using text
    macros

  3. Units are able to be created in any part of code
    within a map, also able to have custom options
    to customise the unit (note: creating a unit inside
    an object or creating an object over the unit would
    probably bug) this change counts as a fix to bug
    no. 6 although adds another known bug

  4. System now works on any size map without code
    modification

  5. Fixed bug no.2 so you can no longer walk on the bottom
    edge of an object and not fall

  6. Fixed bug no.3 enough for it not to be noticaeble,
    with the unit getting stuck while walking along
    an object to another, although bugs with objects
    next to each other with one or more objects being
    stacked on each other still

  7. Fixed bug no.5 so you can not select nor deselect
    units

Do you like the new way of how I set things out?
 
Thanks for the appreciation. ^^

What I am working now is to make a creatable object that isn't a plain rectangle, but able to be morphed.

Here is an example (The top and bottom of the object will be flat though).
You may want to note that objects are checked in different sectors of the map of only where the collision-able unit is (the one that you control) (not quite easy to explain).

What I am working on now is to make it so that the object will initialize like in this example sector 1, 2 and 5 and not any other. (I'll be figuring this out all on my own)
attachment.php
 

Attachments

  • dimenrtioiionasd.png
    dimenrtioiionasd.png
    24.8 KB · Views: 556
I actually did something like this before, switching between ground and flying units and using air and ground pathing blockers:

http://www.thehelper.net/forums/showthread.php/145900-Multi-Floor-System?highlight=floor+system


However, air pathing blockers were always buggy and also randomly had an impact on ground units aswell.

Another problem was that transitioning units to air units also removed the collision.



Basicly, this experiment resulted in the following requirements to work:
- Arrow key controls (as you can not click in the air, obviously)
- A custom collision system (air units have no collision)
- A custom pathing blocker system for the top layer (to avoid air pathing blockers)
- Adding a shadow model to the unit that can be attached to unit origin (as shadows will not get drawn upon doodads)
 
I did something similar to what you have done.
With switching a ground unit into an air unit, using invisible bridges to change the unit height over the bridge.
Indicating the edges of the platform with regions instead though.
War Carts
I got the system working well(don't think it works in multiplayer though tbh iirc :s).

I soon also experimented with using regions as blocks(iirc one trigger for each block).
I remember getting it to function like the system I have here today.
Although the system was very tedious to use.
Yay for GUI days.
(I lost the map though unfortunately)

With this system I hope to be able to make the 3D objects mass produceable and as dynamic as possible.

Everything will be stored with variables instead of relying on game data. Actually the last thing that I need to
code for that that has been left behind is the current coordinates of the unit itself. Although what I was getting
at is that this system isn't limited by such things like using pathing blockers.
The only thing that will actually be checked that will rely on game data is the terrain z of the coordinates that will be checked.

This system will be so satisfying to me if I get it running 100%.
 
Update!
Sorry for being lazy guys, but I have alot of other things on my mind.

It's not a large update, but more to say that I am still working on this and will when I have the time again.
The content from this version is actually from over a month ago, but creating a presentable version takes time and effort I would rather spend elsewhere.

Anyway enough of my blabber.

Updates: beta .2 -> beta .3

Main changes:

Minor changes:

  1. Jumping to hit the min z of an object will no longer
    create bugs

  2. Code has started in construction for creating objects
    with polygon figure

  1. Some documentatio has been fixed

  2. Alot of notes(for debuging) have been created(for myself)

  3. Walking off the side of the map creates a fatal error
    instead of heavy lag
 
Updated to 0.4.0.0 Beta!

Change log:

Known bugs:

Ideas:

  1. Added new function calls for destroying 3D objects,
    detaching units from the system and changing the units
    coordinates and facing angle
  2. The system has been completely recoded with structs to
    help me with coding the system itself and with this
    the code has been cleaned a lot
  3. Completely removed and scrapped the "Create System Unit"
    function (must use the "Attach System Unit" method now)
  4. Created a manual to help users use the system in their
    maps
  5. Some physics may have been altered for the system

  1. If you try walking under an object you will not be
    stopped(although your are stopped at the min z of the
    object when jumping)
  2. Edge of object clipping occurs
  3. Walking off the edge of the map will make your units
    model disappear. ((Not tested.) Although it is possible
    to create collision objects outside the edge of the map)
  4. Setting a destructables health % to 0 will not remove the
    collision object attached to it
  5. Creating collision objects with any patch of blizzard water
    will create glitching (must have no indication of blizzard water
    around objects with this system for this system to function)
  6. Jumping works half the time when walking down steep cliffs
  7. (Not tested.) If you try and collide with a thin enough object you
    can walk through it
  8. (Not tested.) Removing a 3D collision objects that is attached to
    an destructable before killing the detstructable first will cause bugs
  9. (A possibility.) Some objects do not register or get destroyed properly


  1. Unit Movement with mouse clicks (allow disabling of the Camera
    Arrow structs to be replaced by the normal camera and movement to
    be made by clicks)
  2. Use plains for collition (will help with unnesesary object clipping)
  3. Allow sliding along edges of objects to not stop movment with a
    thickness limit
  4. Make sliding on steep cliffs
  5. Allow usage of triangle like 3D object with z variance
  6. Add extra function calls with hooking to players that use arrow keys
    to move their unit
  7. Hooking to allow units to have unique values for instance their movement
    speed, facing speed and drop and jump rate
  8. Allow a function call that can call once or multiple times when a unit
    enters a 3D objects area and can get the unit that entered
  9. Have a hack for WE that allows placment of 3D collition objects or
    atleast detect the Z value(or fly height like units) of destructables
  10. Allow objects to be stored into variables and moved after creation
  11. When destructables are moved that have objects attached to them move
    them with the destructable and viseversa
  12. Store object data into a variable that allows it to be recreated at a
    coordinate
____


Anyway this update took longer than I anticipated.
Hope that you guys like the new update.

I will be uploading an official one to the spell section when I end up cleaning the necessary bugs.

PS: This could have been uploaded about 4 days aftet Keji unlocked this thread but I got this feeling to recode everything with structs. This is my fist attempt at using them to this would be called my first adaptation to them.

Please feel free to tell me any ways I can improve the description and the system itself.
Thanks all. ^^

PSS: The description will probably be improved within the next thew days (it's really late now and I've just started school again).
 
Status
Not open for further replies.
Top