Sponsored Adverts

Recent Posts

Pages: [1] 2 3 ... 10
1
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on January 13, 2019, 07:27:24 PM »
i've now got the rotating door code working in my door manager script. next i'll work on the sliding doors. which the manager will detect when needed.

in this image we have a script order of "trigger manager > lever manager > door manager" as well as each of them having their respective data scripts, for storing the start and updated variables in.

the order could also just be "trigger manager > door manager" as the lever scripts act as a relay, but are not required. the same principle would apply to buttons, when i've made them.

2
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on January 11, 2019, 09:28:26 PM »
this image shows a test room i built with 25 of kat's lever models. i didn't notice any drop in fps while they were moving, which surprised me.

take into consideration there is only one invisible trigger, and one real time light, which doesn't cast shadows. so this was really to test if the scripting and animating geometry was expensive.

if we had shadows on or more lights, it would slow down to some degree.


3
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on January 11, 2019, 04:48:31 PM »
forgot to mention, this type of code can also be used for tanks or turrets where the parent object is rotated in one direction and the child object faces another.

i'm currently working on the door manager, which will switch between sliding and rotating doors, depending on the door data scripts.
4
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on January 11, 2019, 02:46:21 AM »

after a lot of experimenting over the last couple of weeks, i've nearly finished the lever manager. the following post is related more to the code than level design...

1st image is the whole of my lever data script. these would be attached to each of the lever prefabs.



level designers could replace the meshes and textures with different versions if they wanted, as long as the prefabs followed the hierarchical structure of the ones that i'll be releasing, hopefully in the near future. alternatively coders could edit the scripts to suit their own designs.

lines 17-20 are what we're focusing on here, as they are used to store the reference to the prefab's pivot, the start and end rotations, as well as the target rotation. the latter toggles between start and end when the lever reaches the target rotation.

2nd image is part of my start function of the lever manager script. the various managers are attached to an empty game object in the root of the scene's hierarchy window. there is only one manager of each type.



lines 89-92 are assigning the initial values to the data script's variables. the most important, and difficult for me to figure out, was line 91. which is the end rotation.

to my surprise, that line didn't require at this stage, any reference to the pivot. instead it's using my inspector variable "end angle x", which defaults to 90 degrees. it also references the vertical "y" axis of the prefab parent, ie the lever base.

3rd image is part of the "fixed update" function (ie physics update) of the manager script.



line 126 is interpolating between the current rotation (taken from the pivot each frame) and the target rotation.

i was surprised by how high the "250" value ended up being, as that determines speed per second. normally i move or rotate objects with values between 5-25. i guess it has something to do with converting that value to degrees, but it's still weird looking. any less and it was moving too slow in my opinion.

that value could be exposed in the inspector for the lever designers, but for now i'm leaving it hard coded.

another thing which i'm still trying to comprehend, is the beginning of that line has "leverData.pivot.rotation = " which means it's not just storing the interpolated value in the data script, but also apparently applying it to the actual pivot, rather than a reference to it. i assume this has something to do with "reference types vs value types" although admittedly i'm not good at distinguishing the former.

in the past i would have done those separately. it was actually a typo that i wrote it like this, but it produced good results so i kept it.

...

a longer version of the lever manager script that i got working a couple of days ago, took a slightly different approach. in that instead of interpolating between start and end quaternions, i broke it down to interpolating a "current angle x" floating point variable, similar to the "end angle x" previously mentioned.

i then used a built in quaternion function to construct the current rotation from the "x, y, z" and applied that to the pivot.

the reason i had tried that was i wanted more control over each frame. so in effect constraining the "y" and "z" axis so there was no unwanted drift on them. turns out i didn't need to do that but it's good to know we can if need be.

in summery, it was a lot of hard work to get the levers to behave as i wanted, although i learned several very useful things in the process... there's even a couple of interpolate functions that i tested, that have acceleration and deceleration in their movement. in the end, i opted for a constant speed for these levers as that seemed more natural.
5
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on January 10, 2019, 09:46:03 PM »
these images show two of kat's lever models made in blender, and being animated in unity by my lever manager script. my inspector variable "end angle x" is used in the 2nd image to limit the range the lever can rotate, so it doesn't pass through it's base.




6
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on January 04, 2019, 07:37:38 PM »

one of main the reasons why i wanted to write my own trigger system, albeit using one of the built in unity physics functions, was to reduce the amount of function calls. especially to the target scripts.

although my trigger manager script does read and write a lot to it's data scripts, the latter only contain a few lines of code each. so in theory this system when finished could be faster than the unity built in function "on trigger stay", possibly also the "on trigger enter" and "on trigger exit".

in the 1st image we see my trigger data script for a lever object has been set to use "activation auto". which would normally be used for  doors that don't require manual activation, other than the player or npc's walking up to them. i was just testing using the lever, but it could have been any object that can be triggered.



keep in mind, the unity debug logs printed in the console window, do significantly slow down the game, so most of the time we'd have them disabled. with that being said there is only a couple of function calls from my trigger manager to my lever manager, and that was due to me moving the player in and out of the trigger volume, which the data script is attached to.

compare that to the much higher "fast update index" and "collider count" logs, which are keeping track of all the dynamic collider objects inside the trigger volumes. in this case just the player, but could be lots of objects inside several different volumes, which the manager cycles through when it does it's fast or slow update.

to clarify, this system acts like the built in "on trigger stay", except it only calls the target scripts once per "enter" and "exit".

in practice, if this was an auto activated door, it would open when the player walks up to it, ie enters a trigger volume. then the door would stay open until the player had left the trigger volume, on the other side.

my trigger data scripts can also be set to "use once" in which case the manager removes them from the game after the "enter" event, so frees up some memory and cpu.

the 2nd image is similar to the previous test, except the data script is set to manual activation. that can only call the target script when a player is inside the trigger volume and using a "activate" key input.



there is a short timer delay between those function calls so the player can't keep spamming the input. in the future, i might make the delay an inspector variable, so level designers can choose their own values. but for now having a delay of about 1 second seems to work well. if there was no delay, then there could be 30 or 60 functions calls a second to the target script if the player held down their activation key. which would be a waste of resources, and eventually slow down the game.
7
Video Channel / [IMVU] Make an earring accessory (Beginner Friendly)
« Last post by kat on December 25, 2018, 06:12:47 PM »

In the video below jazzKat walks through the process of making a very simple bauble earring accessory from basic shapes in Blender (UV sphere, cylinder and a torus) that's textured, positioned and then exported to FBX for import and assembly in IMVU. Recorded live on Twitch (may include off topic comments and conversation).

Beginner Friendly

Steps summary
- Delete default cube so no materials are available (optional)*.
- Add UV Sphere, Cylinder & Torus (reduce density as added).
- Shape, scale and position meshes.
- Add Materials (plus Textures & pre-made images).
- Assign images to object using pre-generated UV maps.
- Join objects together.
- Append to Accessory Starter File and position.
- Assign Vertex Group and Parent to 'Head' Armature.
- Export - File » Export » FBX (.fbx).
- Import and assemble.

Source file

Twitch

YouTube alternative
8
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on December 25, 2018, 01:56:54 AM »

i'm getting on well with writing a script based trigger system, to replace the in built unity one. mine does use some of the unity functions like "Physics.OverlapBoxNonAlloc" but it doesn't use "OnTriggerEnter" etc.

it has optional features like matching trigger id to colliding object's id, combined mass of colliding objects for pressure pads etc and different update speeds.

the latter can help with performance, as the "slow" option only checks one trigger volume per frame, as opposed to "fast" which loops through all triggers every frame. there is also an "auto" update speed, which dynamically switches between the the other modes, depending on what is going on in the game.

it's a manager and data system. meaning the scripts attached to the empty game objects that turn them into triggers are relatively small, as they contain very little, if any logic, and no update functions. the logic and updates are processed in the manager, after it has found and populated a list of triggers at start up. i'm also writing a series of other managers to handle different aspects of the gameplay.

below are some screencaps of this work in progress. note the verbose debug logging in the 3rd image is not displayed by default, it's just an option that level designers can toggle in the unity inspector, mainly for the purpose of tracking what the triggers are doing, if needed.

although it looks complicated, the end result should be straight forward for most level designers, as it's based on drag and drop and check box interface design. in theory it should only take a few minutes to set up, once someone follows the step by step instructions, that myself or kat will write in the future.





9
Video Channel / [IMVU] Make a ring/gift box accessory (Beginner Friendly)
« Last post by kat on December 22, 2018, 06:56:09 PM »

In the videos below jazzKat walks through the process of making a very simple hand held ring/gift box accessory in Blender using four cubes that are then textured, positioned and then exported to FBX for import and assembly in IMVU. Recorded live on Twitch (may include off topic comments and conversation).

Beginner Friendly

Steps summary
- Delete default cube so no materials are available (optional)*.
- Add a new Cube - Add » Mesh » Cube.
- Add new Material (plus Texture and Image).
- UV unwrap cube - Mesh » UV » Reset.
- Duplicate Cube to make bow - Object » Duplicate Objects.
- Make 'bow' Material (plus Texture and Image).
- UV unwrap and edit UV map.
- Append to Accessory Starter File - File » Append.
- Assign Vertex Group and Parent to Armature.
- Export - File » Export » FBX (.fbx).
- Import and assemble.

note: * as the default Cube has a pre-assigned Material so the object was deleted to better reflect what is more likely going to be the case; a mesh being added to the scene without Materials, requiring their generation.

Source files

Twitch version

YouTube version
10
News / Re: [Unity] Fantasy asset pack for maps, levels, environments
« Last post by ratty redemption on December 15, 2018, 09:27:40 PM »
thanks kat.
Pages: [1] 2 3 ... 10
Sponsored Adverts
RSS Content is copyright © KatsBits™ 2018 unless otherwise stated. All Rights Reserved.
No part of this web site may be reproduced (except for personal use, or otherwise stated) without prior written permission from KatsBits.com. For more infomation on copyright click here.
Web design cpdtAdvertisePrivacy PolicyDMCA (about DMCA) Home Store Workshops Blog Jobs Support About Katsbits Contact Site Search KatsBits Help Site Map RSS feed Forum YouTube FaceBook LinkedIn Twitter IMVU