Jump to content

smoothMoveCamera


Recommended Posts

السلام عليكم

بغيت اسوي كاميرا تتحرك

  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(396, 330, 148, 151, "camera", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.button[1] = guiCreateButton(14, 34, 54, 23, "camera", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(14, 67, 54, 23, "stopc", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(14, 100, 54, 23, "close", false, GUIEditor.window[1])     
    end 
) 
  
addEventHandler("onClientGUIClick", root, 
    function() 
    if (source == GUIEditor.button[1]) then 
    setCameraMatrix(287.76278686523,1922.9759521484,66.71354675293,211.43293762207,1895.4426269531,8.2698106765747) 
    end 
    end) 
    addEventHandler("onClientGUIClick", root, 
    function() 
    if (source == GUIEditor.button[2]) then 
smoothMoveCamera(2113.8352050781,1209.8538818359,60.945999145508,2114.2651367188,1208.9752197266,60.738212585449,2122.6770019531,1245.2310791016,56.893001556396,2121.8374023438,1245.7521972656,56.738994598389,1000) 
    end 
    end 
    ) 

بس ما تتحرك ممكن اعرف ليه؟؟

اللوحة تجريبية للعلم

Link to comment

local sm = {} 
sm.moov = 0 
sm.object1,sm.object2 = nil,nil 
  
local function removeCamHandler() 
    if(sm.moov == 1)then 
        sm.moov = 0 
    end 
end 
  
local function camRender() 
    if (sm.moov == 1) then 
        local x1,y1,z1 = getElementPosition(sm.object1) 
        local x2,y2,z2 = getElementPosition(sm.object2) 
        setCameraMatrix(x1,y1,z1,x2,y2,z2) 
    end 
end 
addEventHandler("onClientPreRender",root,camRender) 
  
function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time) 
    if(sm.moov == 1)then return false end 
    sm.object1 = createObject(1337,x1,y1,z1) 
    sm.object2 = createObject(1337,x1t,y1t,z1t) 
    setElementAlpha(sm.object1,0) 
    setElementAlpha(sm.object2,0) 
    setObjectScale(sm.object1,0.01) 
    setObjectScale(sm.object2,0.01) 
    moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad") 
    moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad") 
    sm.moov = 1 
    setTimer(removeCamHandler,time,1) 
    setTimer(destroyElement,time,1,sm.object1) 
    setTimer(destroyElement,time,1,sm.object2) 
    return true 
end 
  
  
  
  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(396, 330, 148, 151, "camera", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        GUIEditor.button[1] = guiCreateButton(14, 34, 54, 23, "camera", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(14, 67, 54, 23, "stopc", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(14, 100, 54, 23, "close", false, GUIEditor.window[1])     
    end 
) 
  
addEventHandler("onClientGUIClick", root, 
    function() 
    if (source == GUIEditor.button[1]) then 
    setCameraMatrix(287.76278686523,1922.9759521484,66.71354675293,211.43293762207,1895.4426269531,8.2698106765747) 
    end 
    end) 
    addEventHandler("onClientGUIClick", root, 
    function() 
    if (source == GUIEditor.button[2]) then 
smoothMoveCamera(2113.8352050781,1209.8538818359,60.945999145508,2114.2651367188,1208.9752197266,60.738212585449,2122.6770019531,1245.2310791016,56.893001556396,2121.8374023438,1245.7521972656,56.738994598389,1000) 
    end 
    end 
    ) 
Link to comment

اها ممكن تعطيني الكود كامل دون اللوحات اشوف كيف

2113.8352050781,1209.8538818359,60.945999145508,2114.2651367188,1208.9752197266,60.738212585449,2122.6770019531,1245.2310791016,56.893001556396,2121.8374023438,1245.7521972656,56.738994598389

يا ريت لو وضحت ايضا وين كمان نقطة البدء ونقطة النهاية

Link to comment

bool smoothMoveCamera ( float x1, float y1, float z1, float x1t, float y1t, float z1t, float x2, float y2, float z2, float x2t, float y2t, float z2t, int time ) 

x1, y1, z1: The camera's start position.

x1t, y1t, z1t: The camera's start look at.

x2, y2, z2: The camera's end position.

x2t, y2t, z2t: The camera's end look at.

time: The speed of the camera's movement.

مايبيلها

Link to comment

ما يبيلها ذكاء :]

ذول وش يختلفون عن بعض الاثنين نقطه بداية؟

x1, y1, z1: The camera's start position.

x1t, y1t, z1t: The camera's start look at.

ذول بعد

x2, y2, z2: The camera's end position.

x2t, y2t, z2t: The camera's end look at.

Link to comment
ما يبيلها ذكاء :]

ذول وش يختلفون عن بعض الاثنين نقطه بداية؟

x1, y1, z1: The camera's start position.

x1t, y1t, z1t: The camera's start look at.

ذول بعد

x2, y2, z2: The camera's end position.

x2t, y2t, z2t: The camera's end look at.

واضحة من الشرح -_-

احداثيات بداية الكاميرا

لفت الكاميرا عند البداية

الاحداثيات الي تنتهي بها او توقف عندها الكاميرا

لفت الكام عند النهاية

Link to comment

المشكله الوقت لما احطه 3 دقائق يصير بطيء جدا ويصير اخر شي سريع مره ابي السرعه تكون معتدلة

+مثلن لو ضغط زر ينفع يتحقق من مكان الكاميرا وينتقل للمكان الجديد دون نقطة بدء جديدة

Edited by Guest
Link to comment
لما اخذ احداثيات الكاميرا

2946.4880371094,2920.7419433594,188.51585388184,2893.5454101563,2844.9501953125,150.40184020996

مو المفروض يكونوا 3 فقط؟

لا راجع فنكشن جلب الكاميرا

float float float float float float float float getCameraMatrix (player thePlayer) 

float float float float float float float float getCameraMatrix () 
Link to comment

للفايده فقط

عشان تجيب احداثيات الكاميرا استخدم كود زاحف

addCommandHandler ( "GetCameraPos", function (    ) 
       local x, y, z, xl, yl, zl = getCameraMatrix (    ) 
       if ( x == 0 or y == 0 or z == 0 ) then return end 
       setClipboard ( " "..x..", "..y..", "..z..", "..xl..", "..yl..", "..zl.." " ) 
end ) 

GetCameraPos اكتب باف8

وبعدين بتنسخ تلقائيا الي عليك تلصقها بس

Link to comment

شوف , كل وظيفة مفيدة لازم يكون لها سورس كود

السورس كود يعتبر تعريف للوظيفة

يعني ناخذ مثلا

smoothMoveCamera

السورس كود حقها :

local sm = {} 
sm.moov = 0 
sm.object1,sm.object2 = nil,nil 
  
local function removeCamHandler() 
    if(sm.moov == 1)then 
        sm.moov = 0 
    end 
end 
  
local function camRender() 
    if (sm.moov == 1) then 
        local x1,y1,z1 = getElementPosition(sm.object1) 
        local x2,y2,z2 = getElementPosition(sm.object2) 
        setCameraMatrix(x1,y1,z1,x2,y2,z2) 
    end 
end 
addEventHandler("onClientPreRender",root,camRender) 
  
function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time) 
    if(sm.moov == 1)then return false end 
    sm.object1 = createObject(1337,x1,y1,z1) 
    sm.object2 = createObject(1337,x1t,y1t,z1t) 
    setElementAlpha(sm.object1,0) 
    setElementAlpha(sm.object2,0) 
    setObjectScale(sm.object1,0.01) 
    setObjectScale(sm.object2,0.01) 
    moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad") 
    moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad") 
    sm.moov = 1 
    setTimer(removeCamHandler,time,1) 
    setTimer(destroyElement,time,1,sm.object1) 
    setTimer(destroyElement,time,1,sm.object2) 
    return true 
end 

هذا هو تعريف للفانكشن

لان الفانكشن اساسا ماله وجود باللعبة , بس الي برمجه عطاك الكلام الي فوق

على شان يتعرف السيرفر على الفانكشن ذا

وحطه اول شي في ملف الكلاينت

وبالنسبة للإحداثيات

x1

y1

z1

هذي هي احداثيات

xyz

العادية الي ممكن تحصلها بأكثر من فانكشن

مثل إنشاء الماركر , تحط له الأحداثي

x1t

y1t

z1t

هذي احداثيات النظر

يعني يوم تجي تسوي المود

وين تبي الكاميرا تكون تنظر , لأي جهه ؟

x2

y2

z2

هذي نفس إحداثيات

xyz

بس هذي حقت المكان الي تبيه ينتهي عنده

x2t

y2t

z2t

هذي نفس الي قلت لك عليه فوق عند

x1t

بس هذي تحط فيها وين تكون الكاميرا عند الإنتهاء

x1 & x1t = وضع بداية الكاميرا

x2 & x2t = وضع إنتهاء الكاميرا

موفق

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...