Skip to content

New GSC function: Scale Model #338

@Santahunter

Description

@Santahunter

What problem does this solve?

A new gsc function which allows to rescale a model ingame would be very neat and creates loads of possibilities.
As far as I know its not that difficult technically. Basically a Vector recalculation.

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

ChatGPT Example with a transition

ObjScaler.ScaleObj("./model.obj", "./model_scaled.obj", 2.0f); // I think iw4x models arent .obj files but similar

`
using System;
using System.Globalization;
using System.IO;

public static class ObjScaler
{
public static void ScaleObj(string inputPath, string outputPath, float scaleFactor)
{
var culture = CultureInfo.InvariantCulture;
string[] lines = File.ReadAllLines(inputPath);

    for (int i = 0; i < lines.Length; i++)
    {
        if (lines[i].StartsWith("v "))
        {
            string[] parts = lines[i].Split(' ');
            float x = float.Parse(parts[1], culture) * scaleFactor;
            float y = float.Parse(parts[2], culture) * scaleFactor;
            float z = float.Parse(parts[3], culture) * scaleFactor;

            lines[i] = $"v {x.ToString(culture)} {y.ToString(culture)} {z.ToString(culture)}";
        }
    }

    File.WriteAllLines(outputPath, lines);
    Console.WriteLine("Scaling complete ✅");
}

}

`
// sorry for wrong codeblocking. Github didn't like me, couldnt figure out why

Technical considerations

No response

Compatibility impact

  • This change would be backward compatible
  • This change might break compatibility with existing servers/mods
  • Unsure about compatibility impact

Describe alternatives you've considered

No response

Existing workarounds

No response

Supporting materials

No response

Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I have limited this request to a single feature
  • I have provided clear use cases for this feature
  • I have considered the implementation complexity and compatibility impact

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions