Scripts / doors with collision

Author
Message
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Sep 2019 17:27 Edited at: 3rd Sep 2019 17:27
saw some comments about animated doors not having any collision so made a script that allows you to keep collision on while a door opens / closes
i know there's also a physics hinge by amen too but always nice to have more options
- has a setting in the script to change the direction it opens (i.e. into the house or outside)
- can set the swing speed via the animation speed property in the editor
*notes*
- it does require the door origin point be set to the hinge of the door so won't work with the default doors unfortunately as they would rotate around the center of the door, this is not what we need
- it only works with single doors, if you want double doors you need to place 2 and rotate (& reverse the direction) on the other door
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Sep 2019 18:29
Nice one smallg
Does this mean the door do not need to be animated?
And the origing point in the hinge of the center?
Some doors has 3 hinges.

Thanks for sharing.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Sep 2019 20:17
no animation needed, nope, the script rotates the doors so it knows where the new collision is.
for the pivot it doesn't matter much but i put it in the middle hinge point so that i could get the local prompt at eye level but it just needs to be on the hinge side of the door - technically the ground is better for placing in GG so you may want to put it at the bottom left etc.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 3rd Sep 2019 20:47
Quote: "no animation needed, "
sounds good ,so can the same be done for sliding doors ,just a thought

Dave
Windows 10 Pro 64 bit
GeForce RTX™ 2070 GAMING OC 8G
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
3840 x 2160 ,60 Hz
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 3rd Sep 2019 21:20
There's already a script for doors without animations that make them go up and down, I think smallg made it? That could easily be changed to slide horizontally onstead.

Primary Desktop:
i7 7700,k NV1070 8GB, 16GB 3200mhz memory, 1x 2TB Hybrid, Win10.

Secondary Desktop:
i5 4760k, NV960 2GB, 16GB 2333mhz memory, 1x 2TB Hybrid, Win10.

Laptop:
i3, Intel 4000 series graphics, 6GB memory, 1x 500gb HDD, Win8.1.
granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 3rd Sep 2019 21:28
Quote: "There's already a script for doors without animations that make them go up and down, I think smallg made it? That could easily be changed to slide horizontally onstead."

That’s cool ,dose it keep the collision

Dave
Windows 10 Pro 64 bit
GeForce RTX™ 2070 GAMING OC 8G
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
3840 x 2160 ,60 Hz
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Sep 2019 22:07
Lightweight!

Could have used quaternions to suit doors at any rotation angle!
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 3rd Sep 2019 22:41
Quote: "Lightweight!

Could have used quaternions to suit doors at any rotation angle! "

I considered it as I could make use it to make a version where I wouldn't need to edit the model then but decided this method was easier to understand as I don't need to manually work out where the hinge is, I'm pretty sure I saw some way to get the object extents from you before though so perhaps that can be the next version
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Sep 2019 00:06
Yep all the commands needed are in there now, just have to bolt them all together.

pickuppables.lua is a good crib sheet, it handles entities at any scale with any origin.

Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Sep 2019 12:21 Edited at: 4th Sep 2019 12:23
well i have how to get the point of the hinge... now i just need to figure out how to translate that into code that rotates around that spot
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Sep 2019 13:29
Just math fun.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Sep 2019 20:06 Edited at: 4th Sep 2019 20:08
Just create a quaternion from the current angles then rotate that and convert back to angles to position the entity.

You can even use the SLERP to make it nice and smooth.

Aha, just realised that will only work if the Y axis of the model goes through the origin, otherwise you will need more math as the entity will need to be moved as well as rotated.
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Sep 2019 20:36
Quaternion Slerp, OMG. as I said, math fun.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Bored of the Rings
GameGuru Master
19
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 4th Sep 2019 21:43
quaternions are easy, I'm a stats programmer, so am highly maths skilled, don;t test me. ha
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
fumar
5
Years of Service
User Offline
Joined: 3rd Sep 2019
Location:
Posted: 14th Sep 2019 13:52
Very useful.
Thank you for sharing, @smallg...
PM
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 15th Sep 2019 10:01
great finally.. can this be applied to the carry_object.lus too? so object have collision even when carried?
PC Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA NVDIA 1660GTX 6GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 15th Sep 2019 10:25
Quote: "so object have collision even when carried?"

There's some scripts from amenmoses that do this already in the scriptbank
Try pickupables.lua
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
JC LEON
14
Years of Service
User Offline
Joined: 22nd Apr 2010
Location:
Posted: 15th Sep 2019 13:39
Quote: "There's some scripts from amenmoses that do this already in the scriptbank
Try pickupables.lua"


cool thanks I didnt notice it.. it works perfectly but.. how if i would to add a suond on collision(customisable based on held object) when object is dropped by the player?
PC Specs:
AMD QUADCORE 880K @4.5GHZ, 32GB RAM DDR3 1600, M/B ASUS A88XM-PLUS
SVGA NVDIA 1660GTX 6GB , SSD KINGSTON A400 1TB, 2X HHD SEAGATE BARRACUDA 4TB
PM

Login to post a reply

Server time is: 2024-12-22 09:35:21
Your offset time is: 2024-12-22 09:35:21