Forum rules - please read before posting.

Character change rendering: cannot change scale to the right scale.

edited December 2015 in Technical Q&A
Hi,

I can change the scale but only with integers, for my character I like to use floats, because it is really needed! My character needs to be 2.5 from time to time. How do I achieve this in AC? 

Comments

  • edited December 2015
    Can you use Transform action for your needs?
    If I still remember this might work.
  • 2.5 as a percentage?  I'll concede that being an integer might be a limitation, but you're certain that your intended scale is 0.025?
  • Hi, my scale must be between 2 and 3 and indeed, an integer wouldn't let me...
  • @SkyTree I already tried that but thanks for your help :) (It wouldn't work)
  • (my character needs to be scale 3 in scene 2 but when he comes back to scene 1 he was 2.5, so I need the same 2.5 scalet)
  • I tried to write an Action for AC but it took me too long... so I just wrote a very simple script for demonstration purposes, how hard is this to get in Action? It should be very easy, I know.. it's just I almost never script anymore so I have to search everything again to be able to make that Action. But this is what I want to do in a normal AC action:

    using UnityEngine;
    using System.Collections;

    public class ScaleChar : MonoBehaviour {


    public Transform player;
    public Vector3 Scale = new Vector3();
    public bool scaleplayer;

    // Use this for initialization
    void Start () {
    }
    // Update is called once per frame
    void Update () {
    if(scaleplayer){

    player.transform.localScale = Scale;


    }
    }

    void OnTriggerEnter(Collider other){
    if(player.transform.tag == "Player"){
    scaleplayer = true;
    Debug.Log("Hitted Player");

    }

    }

    }

  • You don't want to call it in an Update - instead, just lock the scale to a value:

    player.lockScale = true;
    player.spriteScale = 0.025;


    This code would be placed in an Action's Run() function, as covered here.
  • Thank you, I am making a 2.5D game though, With 2D backgrounds and 3D characters. So I need to scale my 3D character, not a sprite, does this work the same with 3D characters?
  • My intended scale is 2.5, not 0.025 btw. But I cant write dots in the change character render action.
  • From what I was asking you before, I thought you were after 2.5%.

    If you're working with a 3D character, you just want to change the transform scale:

    player.lockScale = true;
    player.transform.localScale = new Vector3 (2.5f, 2.5f, 2.5f);
  • Thanks Chris, it works as a custom AC action now.:)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.